Hi,
I've been trying to integrate Netty into JBM2 since the end of last week. I
enountered a problem while implementing MessagingBuffer. According to the source code, a
MessagingBuffer implementation is supposed to increase its capacity automatically when it
runs out of space. It's what exactly MINA IoBuffer does. Netty has a
CompositeByteArray which does similar thing, but it's different from IoBuffer in that
it doesn't have position and limit, which means there's no need for flip or
rewind. Also, automatic expansion of the buffer is implemented very differently -
it's not reallocation and copy but adding a new chunk to the end of the list.
There are a few ways to resolve this differences (in the order of better performance):
1) Replace MINA stuff with Netty and remove position(), limit(), flip(), rewind() and etc
from MessagingBuffer.
2) Emulate the current behavior with NIO BuyeBuffer classes.
3) Emulate the current behavior with Netty classes
Of course, the option 1 involves the biggest change among the three and will require the
changes in unit tests, while it would be fun for me.
Another alternative is the option 2 - most part of the code is done in NIO ByteBuffer so
the implementation shouldn't be that difficult, but I still have to deal with
auto-expansion, which leads to unnecessary memory copy.
Option 3 is the worst of all because we are going to build something on top of something
built on top of existing buffer (or byte array).
Which option shall I go with? Whichever option we choose, we should make all the existing
tests pass.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4161721#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...