You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by Trustin Lee <tr...@gmail.com> on 2004/12/19 11:03:18 UTC
[mina] Current status
Hi.
I added/applied bunch of features and fixes to MINA today. This post
summarizes them.
1. IoHandlerFilter and ProtocolHandlerFilter is added.
http://svn.apache.org/viewcvs.cgi/incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandlerFilter.java?rev=122724&view=auto
and
http://svn.apache.org/viewcvs.cgi/incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolHandlerFilter.java?rev=122724&view=auto
They are very similar to that of Servlet filters as you see. Adapter
classes are also provided to let user filter required events only
easily. Here is a blacklist filter:
http://svn.apache.org/viewcvs.cgi/incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/filter/BlacklistFilter.java?rev=122739&view=auto
Acceptor, Connector, and IoAdapter provides addFilter(...) and
removeFilter(...) methods and you can add or remove filters at any
time. Here is an example:
Acceptor acceptor = new TcpAcceptor();
acceptor.bind(new InetSocketAddress(8080), new MyIoHandler());
BlacklistFilter filter = new BlacklistFilter();
acceptor.addFilter(10, filter); // 10 is a priority number.
filter.block(new InetAddress("192.168.0.1"));
You can add ProtocolHandlerFilters to IoAdapter of course:
Acceptor acceptor = new TcpAcceptor();
IoAdapter ioAdapter = new IoAdapter();
acceptor.bind(new InetSocketAddress(8080), ioAdapter.adapt(new
MyProtocolProvider()));
ioAdapter.addFilter(0, new MyCoolProtocolFilter());
2. There is no need to explicitly start/stop I/O threads.
I/O threads starts when there are any channels to handle, and they
stops when there are no channels to do. So convenient, eh? :)
Now I'll implement thread-pool which is IoHandlerFilter and
ProtocolHandlerFilter sooner or later. If once done, we could
benchmark and profile MINA with lots of clients and tune her.
Actually I don't have much experience with benchmarking massively by
myself. Is there anyone who can help me? I need some URLs of tools
and articles about it.
Cheers,
Trustin
--
what we call human nature is actually human habit
--
http://gleamynode.net/
Re: [mina] Current status
Posted by Berin Loritsch <bl...@d-haven.org>.
Alex Karasulu wrote:
> Berin, Trustin wdyt about using similar constructs in SEDA or even
> making these filter interfaces common (shared across sedang and mina)
> in the protocol API packages? Is it worth doing that? Me, I think so.
Trustin and I exchanged IM addresses so that we can discuss just that.
I'd like to come up with a decent
API, and there are good things that come from both approaches to network
development. So, the big
question is what is the best blend. I'm sure we will come up with
something good.
--
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning."
- Rich Cook
Re: [mina] Current status
Posted by Trustin Lee <tr...@gmail.com>.
Hi,
<snip/>
> Berin, Trustin wdyt about using similar constructs in SEDA or even
> making these filter interfaces common (shared across sedang and mina) in
> the protocol API packages? Is it worth doing that? Me, I think so.
Good idea.
> >I/O threads starts when there are any channels to handle, and they
> >stops when there are no channels to do. So convenient, eh? :)
> >
> Huh? I must have missed someting :). How does this work with thread
> pools? And why do you do this? Meaning what's the advantage?
The biggest advantage is that there is no need to explicitly invoke
start() and stop() methods. For example:
Acctptor acceptor = TcpAcceptor();
acceptor.bind(new InetSocketAddress(8080)); // i/o thread starts
....
acceptor.unbind(new InetSocketAddress(8080)); // i/o thread stops if
there are no connection available
...
// finally all threads will die when all connections are closed
This is good because JVM shuts down very smoothly without any stop() method.
BTW, filters doesn't have any life cycle methods like 'shutdown()', so
if there are any filters which need lifecycle management we'll suffer
from that. It would be nice to add 'destroy()' method to handle that
properly.
Cheers,
Trustin
--
what we call human nature is actually human habit
--
http://gleamynode.net/
Re: [mina] Current status
Posted by Alex Karasulu <ao...@bellsouth.net>.
Trustin Lee wrote:
>Hi.
>
>I added/applied bunch of features and fixes to MINA today. This post
>summarizes them.
>
>1. IoHandlerFilter and ProtocolHandlerFilter is added.
>
>http://svn.apache.org/viewcvs.cgi/incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandlerFilter.java?rev=122724&view=auto
>
>and
>
>http://svn.apache.org/viewcvs.cgi/incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolHandlerFilter.java?rev=122724&view=auto
>
>They are very similar to that of Servlet filters as you see. Adapter
>classes are also provided to let user filter required events only
>easily. Here is a blacklist filter:
>
>http://svn.apache.org/viewcvs.cgi/incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/filter/BlacklistFilter.java?rev=122739&view=auto
>
>
>
Yeah the pattern can handle serveral different kinds of use cases. It
was an excellent choice!
>Acceptor, Connector, and IoAdapter provides addFilter(...) and
>removeFilter(...) methods and you can add or remove filters at any
>time. Here is an example:
>
>Acceptor acceptor = new TcpAcceptor();
>acceptor.bind(new InetSocketAddress(8080), new MyIoHandler());
>BlacklistFilter filter = new BlacklistFilter();
>acceptor.addFilter(10, filter); // 10 is a priority number.
>filter.block(new InetAddress("192.168.0.1"));
>
>You can add ProtocolHandlerFilters to IoAdapter of course:
>
>
>
Berin, Trustin wdyt about using similar constructs in SEDA or even
making these filter interfaces common (shared across sedang and mina) in
the protocol API packages? Is it worth doing that? Me, I think so.
>Acceptor acceptor = new TcpAcceptor();
>IoAdapter ioAdapter = new IoAdapter();
>acceptor.bind(new InetSocketAddress(8080), ioAdapter.adapt(new
>MyProtocolProvider()));
>ioAdapter.addFilter(0, new MyCoolProtocolFilter());
>
>
>2. There is no need to explicitly start/stop I/O threads.
>
>I/O threads starts when there are any channels to handle, and they
>stops when there are no channels to do. So convenient, eh? :)
>
>
>
Huh? I must have missed someting :). How does this work with thread
pools? And why do you do this? Meaning what's the advantage?
>Now I'll implement thread-pool which is IoHandlerFilter and
>ProtocolHandlerFilter sooner or later. If once done, we could
>benchmark and profile MINA with lots of clients and tune her.
>Actually I don't have much experience with benchmarking massively by
>myself. Is there anyone who can help me? I need some URLs of tools
>and articles about it.
>
>
Sorry I don't have much here either. Jeff Machols was going to look
into a protocol and benchmarking tool or build a library with clients
for LDAP. I think there may be an LDAP benchmarking tool out there.
I'll peek here and there to see if I can find something.
This a great work Trustin. I can't wait to see MINA start sucking the
CAT5 cables off of my network!
Cheers,
Alex
Re: [mina] Current status
Posted by Berin Loritsch <bl...@d-haven.org>.
Noel J. Bergman wrote:
>>I highly recommend using Doug Lea's Concurrent library to create the
>>threadpool.
>>
>>
>
>Are we going work with JDK 1.4 or will we require Java 5 for the LDAP
>server? Or will that only be a requirement for SSL?
>
>
>
As far as I know, we are aiming for Java 1.4, but being careful not to
have stuff
break for Java 5. Some things would be much easier if we went all the
way with
Java 5, but considering how young it is it wouldn't be wise to put all
our eggs in
one basket.
--
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning."
- Rich Cook
RE: [mina] Current status
Posted by "Noel J. Bergman" <no...@devtech.com>.
> I highly recommend using Doug Lea's Concurrent library to create the
> threadpool.
Are we going work with JDK 1.4 or will we require Java 5 for the LDAP
server? Or will that only be a requirement for SSL?
--- Noel
Re: [mina] Current status
Posted by Trustin Lee <tr...@gmail.com>.
Hi,
<snip/>
> Trustin, I highly recommend using Doug Lea's Concurrent library to
> create the
> threadpool. He has a PooledExecutor that already is works and is debugged.
> No sense in reinventing the wheel when someone else has done it quite well.
> (In fact, except for the package names, that library became JSR 166 which is
> part of Java 5).
I already looked at it, and it is cool. But PoolExecuter doesn't
guarentee the order of events for the same sessions, so I need some
trick here. I'll adapt a trick from Leader/Followers thread pool.
Cheers,
Trustin
--
what we call human nature is actually human habit
--
http://gleamynode.net/
Re: [mina] Current status
Posted by Berin Loritsch <bl...@d-haven.org>.
Trustin Lee wrote:
>Hi.
>
>I added/applied bunch of features and fixes to MINA today. This post
>summarizes them.
>
>
>
<snip/>
>2. There is no need to explicitly start/stop I/O threads.
>
>I/O threads starts when there are any channels to handle, and they
>stops when there are no channels to do. So convenient, eh? :)
>
>
>Now I'll implement thread-pool which is IoHandlerFilter and
>ProtocolHandlerFilter sooner or later. If once done, we could
>benchmark and profile MINA with lots of clients and tune her.
>Actually I don't have much experience with benchmarking massively by
>myself. Is there anyone who can help me? I need some URLs of tools
>and articles about it.
>
>
Trustin, I highly recommend using Doug Lea's Concurrent library to
create the
threadpool. He has a PooledExecutor that already is works and is debugged.
No sense in reinventing the wheel when someone else has done it quite well.
(In fact, except for the package names, that library became JSR 166 which is
part of Java 5).
If you need info on how to include it as part of a Maven build, Check
out the
Maven build script for sedang.
--
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning."
- Rich Cook