[Design of Messaging on JBoss (Messaging/JBoss)] - MessagingBuffer implementation leaking into MessageImpl
by ataylor
Currently when a message is encoded or decoded, the methods are called from The transport layer and the MessagingBuffer implementation is specific to this transport. The transport will encode/decode the messages by using the MessagingCodecImpl and this in turn delegates down to a specific Packet depending on the PacketType. When a Packet encodes/decodes itself it should not need to know anything about the MessagingBuffer implementation.
However I've noticed that in MessageImpl the body of the message is also a MessagingBuffer and in the constructor and the decode method we default to the Mina Implementation. This all works at present since we only use Mina but will fail when the ByteBufferWrapper or the new Netty implementation when Trustin adds it.
the method clearBody() in JbossBytesMessage and JBossStreamMessage also assumes an implementation.
1 solution would be to add a new class 'MessageBody' that uses an underlying ByteBuffer and when the message is encoded/decoded we call buffer.put(byteBuffer) etc.
I'm not 100% sure what the effect on performance will be but i was thinking that using a direct ByteBuffer will mean no copying is done.
thoughts?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4158966#4158966
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4158966
16 years, 2 months