[jboss-dev-forums] [Design of Messaging on JBoss (Messaging/JBoss)] - ExpandableBuffers and HTTP

clebert.suconic@jboss.com do-not-reply at jboss.com
Fri Feb 27 16:11:57 EST 2009


Andy: As we talked today:

If you change NettyConnection:

   public MessagingBuffer createBuffer(final int size)
  |    {
  | +      return new ChannelBufferWrapper(org.jboss.netty.buffer.ChannelBuffers.buffer(size));
  | -      return new ChannelBufferWrapper(org.jboss.netty.buffer.ChannelBuffers.dynamicBuffer(size));
  |    }
  | 
  | 

org.jboss.messaging.tests.integration.http.NettyHttpTest would have a bunch of failures:


Exception in thread "pool-3-thread-23" java.lang.ArrayIndexOutOfBoundsException
  | 	at org.jboss.netty.buffer.HeapChannelBuffer.setBytes(HeapChannelBuffer.java:130)
  | 	at org.jboss.netty.buffer.HeapChannelBuffer.setBytes(HeapChannelBuffer.java:123)
  | 	at org.jboss.netty.buffer.AbstractChannelBuffer.writeBytes(AbstractChannelBuffer.java:411)
  | 	at org.jboss.netty.buffer.AbstractChannelBuffer.writeBytes(AbstractChannelBuffer.java:406)
  | 	at org.jboss.netty.buffer.AbstractChannelBuffer.writeBytes(AbstractChannelBuffer.java:399)
  | 	at org.jboss.messaging.integration.transports.netty.HttpAcceptorHandler$ResponseRunner.piggyBackResponses(HttpAcceptorHandler.java:202)
  | 	at org.jboss.messaging.integration.transports.netty.HttpAcceptorHandler$ResponseRunner.run(HttpAcceptorHandler.java:181)
  | 	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
  | 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
  | 	at java.lang.Thread.run(Thread.java:619)
  | 

You probably need to call netty.Buffers.dynamic directly instead of using NettyConnection.createBuffer, or maybe we should create another method on Connection for createDynamicBuffer.

(I don't know if it would be possible to know the size of the buffer you need, since this will probably using HTTPEncoding)


View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4213867#4213867

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4213867



More information about the jboss-dev-forums mailing list