qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From grk...@apache.org
Subject svn commit: r1071641 - /qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/transport/network/Disassembler.java
Date Thu, 17 Feb 2011 15:28:34 GMT
Author: grkvlt
Date: Thu Feb 17 15:28:33 2011
New Revision: 1071641

URL: http://svn.apache.org/viewvc?rev=1071641&view=rev
Log:
QPID-3065: Send header and frame data as single buffer

The Disassembler now fills a ByteBuffer with the entire frame contents before
passing it to the Sender.

Modified:
    qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/transport/network/Disassembler.java

Modified: qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/transport/network/Disassembler.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/transport/network/Disassembler.java?rev=1071641&r1=1071640&r2=1071641&view=diff
==============================================================================
--- qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/transport/network/Disassembler.java
(original)
+++ qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/transport/network/Disassembler.java
Thu Feb 17 15:28:33 2011
@@ -101,20 +101,23 @@ public final class Disassembler implemen
     {
         synchronized (sendlock)
         {
-            header.put(0, flags);
-            header.put(1, type);
-            header.putShort(2, (short) (size + HEADER_SIZE));
-            header.put(5, track);
-            header.putShort(6, (short) channel);
-
-            header.rewind();
-
-            sender.send(header);
+            ByteBuffer data = ByteBuffer.allocate(size + HEADER_SIZE);
+            data.order(ByteOrder.BIG_ENDIAN);
+            
+            data.put(0, flags);
+            data.put(1, type);
+            data.putShort(2, (short) (size + HEADER_SIZE));
+            data.put(5, track);
+            data.putShort(6, (short) channel);
+            data.position(HEADER_SIZE);
 
             int limit = buf.limit();
             buf.limit(buf.position() + size);
-            sender.send(buf);
+            data.put(buf);
             buf.limit(limit);
+ 
+            data.rewind();
+            sender.send(data);
         }
     }
 



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org


Mime
View raw message