You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2014/05/15 21:28:18 UTC

git commit: Use a fixed buffer to handle incoming deliveries from proton via the receiver.recv method instead of allocating a new byte array each time as the contents are copied out to create the complete frane

Repository: activemq
Updated Branches:
  refs/heads/trunk b83a3d438 -> b9d51bf1d


Use a fixed buffer to handle incoming deliveries from proton via the
receiver.recv method instead of allocating a new byte array each time as
the contents are copied out to create the complete frane

Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/b9d51bf1
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/b9d51bf1
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/b9d51bf1

Branch: refs/heads/trunk
Commit: b9d51bf1d4dc9e4fd9f4275356ac03c2fe652c54
Parents: b83a3d4
Author: Timothy Bish <ta...@gmail.com>
Authored: Thu May 15 15:28:02 2014 -0400
Committer: Timothy Bish <ta...@gmail.com>
Committed: Thu May 15 15:28:02 2014 -0400

----------------------------------------------------------------------
 .../apache/activemq/transport/amqp/AmqpProtocolConverter.java | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/b9d51bf1/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/AmqpProtocolConverter.java
----------------------------------------------------------------------
diff --git a/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/AmqpProtocolConverter.java b/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/AmqpProtocolConverter.java
index b8a27c4..05e20dc 100644
--- a/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/AmqpProtocolConverter.java
+++ b/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/AmqpProtocolConverter.java
@@ -511,6 +511,8 @@ class AmqpProtocolConverter implements IAmqpProtocolConverter {
 
         ByteArrayOutputStream current = new ByteArrayOutputStream();
 
+        private final byte[] recvBuffer = new byte[1024 * 8];
+
         @Override
         public void onDelivery(Delivery delivery) throws Exception {
             Receiver receiver = ((Receiver) delivery.getLink());
@@ -524,9 +526,8 @@ class AmqpProtocolConverter implements IAmqpProtocolConverter {
             }
 
             int count;
-            byte data[] = new byte[1024 * 4];
-            while ((count = receiver.recv(data, 0, data.length)) > 0) {
-                current.write(data, 0, count);
+            while ((count = receiver.recv(recvBuffer, 0, recvBuffer.length)) > 0) {
+                current.write(recvBuffer, 0, count);
             }
 
             // Expecting more deliveries..