Periodic TimerTask in netty
Lev Shock
dein at hackerdom.ru
Mon Sep 5 06:25:33 EDT 2011
Do you want to synchronize, say, processing new network message and sending
new one? But network channel (TCP in particular) is full duplex, and
outgoing data stream does not depend on incoming data stream. Also, there
are many cases when you do not want these streams to be ordered and
synchronized. For example, if you want, while streaming huge file to a
client, to receive some message from that client without interrupting file
transfer.
You don't even always need to synchronize on channel.write(..) method,
because it depends on a) whether your packet encoders have some data which
needs to be synchronized b) whether packets you write to a channel must be
written in some particular order or not (for example, some kind of "ping"
packet and some data packet do not depend on each other and can be sent in
any order).
So, Netty controls INCOMING network events ordering only because it knows
they MUST be ordered to properly handle TCP chunks reassembling into
messages, etc. But when you send a message, you always send it as a whole,
so there is no risk that bytes of this message will be sent in the wrong
order. And it is up to you to decide whether you want to send those whole
messages in some particular order, or not, to synchronize outgoing messages
with incoming messages or not, etc. It depends only on your applications'
logic.
Anyway, you want Netty to support "something" (though I'm still not sure
what it is). Netty is open-source - so feel free to implement the
functionality you want and share it with us. If it will be useful, it will
be included in one of the future versions, that's for sure.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/netty-users/attachments/20110905/0fafceaf/attachment.html
More information about the netty-users
mailing list