"Long running" handlers

"Trustin Lee (이희승)" trustin at gmail.com
Mon Mar 8 06:05:33 EST 2010


infectedrhytms wrote:
> For me as long as the string decoding/encoding and the HeaderHandlers
> execute correctly in the pipeline and my business logic doesn't get affected
> I'm happy.
> 
> So what kind of events are we talking about that can be received out of
> order?

ChannelEvent?  Please refer to Javadoc

Without ExecutionHandler, all events are handled in the same thread,
hence there's no chance of handling events out of order (i.e. all events
are handled sequentially.)

With ExecutionHandler + non-OrderedMemoryAwareThreadPool, the events are
dispatched by different threads.  If there are two events for the same
connection and they are dispatched by two threads, then there is a
chance where the first event is handled later than the second event.

With ExecutionHandler + OrderedMemoryAwareThreadPool, the events are
dispatched by different threads but the events for the same channel will
not be handled simultaneously, hence preserving the order.

Since you sent five messages via the *same* channel, they will be
handled sequentially if ExecutionHandler + OrderedMemoryAwareThreadPool
is used, as you observed already.

For example, you might have sent the following two messages via the same
channel:

    1) INSERT (...) INTO MYTABLE
    2) SELECT COUNT(...) FROM MYTABLE

If OrderedMemoryAwareThreadPool is not used, 2 might be executed before
1.  If that's fine with you, you can use whatever thread pool with
ExecutionHandler.

HTH,
Trustin

-- 
what we call human nature in actuality is human habit
http://gleamynode.net/


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 260 bytes
Desc: OpenPGP digital signature
Url : http://lists.jboss.org/pipermail/netty-users/attachments/20100308/7be920f3/attachment.bin 


More information about the netty-users mailing list