[jboss-dev-forums] [Design of Messaging on JBoss (Messaging/JBoss)] - Re: Integrating Netty into JBM2
trustin
do-not-reply at jboss.com
Tue Jul 1 08:26:16 EDT 2008
Even further, I think we can reuse DataInput and DataOutput interface instead of MessagingBuffer. The reasoning behind this is that putInt() is the only random access method in MessagingBuffer and it's only used for writing the length field during encoding. Except that, every access is sequential.
What the current decoder implementation does is to read the length field first and wait until the whole message is received, which means the whole message is read into memory. Therefore, using a stream to read a message will never block once a message is properly split (or assembled) in the networking layer (MINA or Netty level).
Writing a message is a different matter because we need to fill the length field. We could fill the length field in the networking layer (MINA or Netty level) to work around this issue.
The disadvantage of this approach is that each networking layer implementation should know how one or more packets are split or assembled into a message. It means both MINA-based transport and Netty-based transport should know where the length field of a message is located. It's a little bit of code duplication, but I don't think this will change once implemented because their change means the protocol incompatibility.
read and write methods for SimpleString could be provided as static utility methods or member methods of SimpleString.
WDYT?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4161749#4161749
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4161749
More information about the jboss-dev-forums
mailing list