You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by Alex Burmester <ad...@plushpix.com> on 2005/05/18 17:46:34 UTC

[mina] More complicated example

Hi, I have read through the mina source and understand the simple examples
I also basically understand creation of a more complex protocol.

I am wondering how one would create something like protocol router
where a java process listens on two sets of ports and once connections are 
established, it can route protocol packets between the two sides of the 
server process.

I was originally going to use nio and a single selector thread to do all 
the work because the protocol is lightweight and I would avoid thread 
synchronization issues.  

I came across mina and I like the idea of using an extensible framework.
It appears that if I use mina I will end up with a worker thread per 
listen port in mina and I'm wondering how I can coordinate traffic between 
them without performance issues.

Any ideas?

Thanks,

Alex.


Re: [mina] More complicated example

Posted by Trustin Lee <tr...@gmail.com>.
Hi,

2005/5/20, Alex Burmester <ad...@plushpix.com>:
> Thanks for the tip Trustin,
> 
> Do you have any example of DemuxingProtocolHandler in use?
> 
> I went looking through the directory.apache.org cvs but I don't see it in
> use yet.

None yet, but please look at here:

protocol-providers\ldap\trunk\src\main\java\org\apache\ldap\server\protocol

I implemented this just before imlementing DemuxingProtocolHandler. 
This resembles internal implementation of DemuxingProtocolHandler,
so.. you'll get to know how to implement MessageHandlers.

If you once implement your MessageHandlers, You can register your
message handlers to DemuxingProtocolHandler with registerMessageType
method.

Thanks,
Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/

Re: [mina] More complicated example

Posted by Trustin Lee <tr...@gmail.com>.
Hi Alex,

2005/5/19, Alex Burmester <ad...@plushpix.com>:
> I am wondering how one would create something like protocol router
> where a java process listens on two sets of ports and once connections are
> established, it can route protocol packets between the two sides of the
> server process.

You can create one acceptor and bind more than one IoHandler or
ProtocolProvider.

Thanks,
Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/