qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgodf...@apache.org
Subject svn commit: r1693325 - in /qpid/java/trunk: broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ common/src/main/java/org/apache/qpid/framing/ common/src/main/java/org/apache/qpid/transport/ common/src/main/java/org/ap...
Date Wed, 29 Jul 2015 17:54:28 GMT
Author: rgodfrey
Date: Wed Jul 29 17:54:28 2015
New Revision: 1693325

URL: http://svn.apache.org/r1693325
Log:
QPID-6662 : For small buffers use a heap byte buffer

Modified:
    qpid/java/trunk/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerDisassembler.java
    qpid/java/trunk/common/src/main/java/org/apache/qpid/framing/AMQFrame.java
    qpid/java/trunk/common/src/main/java/org/apache/qpid/framing/AMQMethodBodyImpl.java
    qpid/java/trunk/common/src/main/java/org/apache/qpid/framing/ContentHeaderBody.java
    qpid/java/trunk/common/src/main/java/org/apache/qpid/transport/ProtocolHeader.java
    qpid/java/trunk/common/src/main/java/org/apache/qpid/transport/network/InputHandler.java

Modified: qpid/java/trunk/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerDisassembler.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerDisassembler.java?rev=1693325&r1=1693324&r2=1693325&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerDisassembler.java
(original)
+++ qpid/java/trunk/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/ServerDisassembler.java
Wed Jul 29 17:54:28 2015
@@ -93,7 +93,7 @@ public final class ServerDisassembler im
 
     private void frame(byte flags, byte type, byte track, int channel, int size, ByteBuffer
buf)
     {
-        ByteBuffer data = ByteBuffer.allocateDirect(HEADER_SIZE);
+        ByteBuffer data = ByteBuffer.allocate(HEADER_SIZE);
 
         data.put(0, flags);
         data.put(1, type);

Modified: qpid/java/trunk/common/src/main/java/org/apache/qpid/framing/AMQFrame.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/common/src/main/java/org/apache/qpid/framing/AMQFrame.java?rev=1693325&r1=1693324&r2=1693325&view=diff
==============================================================================
--- qpid/java/trunk/common/src/main/java/org/apache/qpid/framing/AMQFrame.java (original)
+++ qpid/java/trunk/common/src/main/java/org/apache/qpid/framing/AMQFrame.java Wed Jul 29
17:54:28 2015
@@ -72,7 +72,7 @@ public class AMQFrame extends AMQDataBlo
     @Override
     public long writePayload(final ByteBufferSender sender) throws IOException
     {
-        ByteBuffer frameHeader = ByteBuffer.allocateDirect(7);
+        ByteBuffer frameHeader = ByteBuffer.allocate(7);
 
         frameHeader.put(_bodyFrame.getFrameType());
         EncodingUtils.writeUnsignedShort(frameHeader, _channel);

Modified: qpid/java/trunk/common/src/main/java/org/apache/qpid/framing/AMQMethodBodyImpl.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/common/src/main/java/org/apache/qpid/framing/AMQMethodBodyImpl.java?rev=1693325&r1=1693324&r2=1693325&view=diff
==============================================================================
--- qpid/java/trunk/common/src/main/java/org/apache/qpid/framing/AMQMethodBodyImpl.java (original)
+++ qpid/java/trunk/common/src/main/java/org/apache/qpid/framing/AMQMethodBodyImpl.java Wed
Jul 29 17:54:28 2015
@@ -118,7 +118,7 @@ public abstract class AMQMethodBodyImpl
     {
 
         final int size = getSize();
-        ByteBuffer buf = ByteBuffer.allocateDirect(size);
+        ByteBuffer buf = ByteBuffer.allocate(size);
         ByteBufferDataOutput dataOutput = new ByteBufferDataOutput(buf);
         writePayload(dataOutput);
         buf.flip();

Modified: qpid/java/trunk/common/src/main/java/org/apache/qpid/framing/ContentHeaderBody.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/common/src/main/java/org/apache/qpid/framing/ContentHeaderBody.java?rev=1693325&r1=1693324&r2=1693325&view=diff
==============================================================================
--- qpid/java/trunk/common/src/main/java/org/apache/qpid/framing/ContentHeaderBody.java (original)
+++ qpid/java/trunk/common/src/main/java/org/apache/qpid/framing/ContentHeaderBody.java Wed
Jul 29 17:54:28 2015
@@ -105,7 +105,7 @@ public class ContentHeaderBody implement
     @Override
     public long writePayload(final ByteBufferSender sender) throws IOException
     {
-        ByteBuffer data = ByteBuffer.allocateDirect(14);
+        ByteBuffer data = ByteBuffer.allocate(14);
         EncodingUtils.writeUnsignedShort(data, CLASS_ID);
         EncodingUtils.writeUnsignedShort(data, 0);
         data.putLong(_bodySize);

Modified: qpid/java/trunk/common/src/main/java/org/apache/qpid/transport/ProtocolHeader.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/common/src/main/java/org/apache/qpid/transport/ProtocolHeader.java?rev=1693325&r1=1693324&r2=1693325&view=diff
==============================================================================
--- qpid/java/trunk/common/src/main/java/org/apache/qpid/transport/ProtocolHeader.java (original)
+++ qpid/java/trunk/common/src/main/java/org/apache/qpid/transport/ProtocolHeader.java Wed
Jul 29 17:54:28 2015
@@ -95,7 +95,7 @@ public final class ProtocolHeader implem
 
     public ByteBuffer toByteBuffer(final boolean useDirect)
     {
-        ByteBuffer buf = useDirect ? ByteBuffer.allocateDirect(8) : ByteBuffer.allocate(8);
+        ByteBuffer buf = ByteBuffer.allocate(8);
         buf.put(AMQP);
         buf.put(protoClass);
         buf.put(instance);

Modified: qpid/java/trunk/common/src/main/java/org/apache/qpid/transport/network/InputHandler.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/common/src/main/java/org/apache/qpid/transport/network/InputHandler.java?rev=1693325&r1=1693324&r2=1693325&view=diff
==============================================================================
--- qpid/java/trunk/common/src/main/java/org/apache/qpid/transport/network/InputHandler.java
(original)
+++ qpid/java/trunk/common/src/main/java/org/apache/qpid/transport/network/InputHandler.java
Wed Jul 29 17:54:28 2015
@@ -50,6 +50,8 @@ import org.apache.qpid.transport.Segment
 public class InputHandler implements ExceptionHandlingByteBufferReceiver, FrameSizeObserver
 {
     private static final Logger LOGGER = LoggerFactory.getLogger(InputHandler.class);
+    private static final ByteBuffer EMPTY_BYTE_BUFFER = ByteBuffer
+            .allocate(0);
 
     private int _maxFrameSize = Constant.MIN_MAX_FRAME_SIZE;
 
@@ -189,7 +191,7 @@ public class InputHandler implements Exc
             channel = (0xFFFF & input.getShort(pos + 6));
             if (size == 0)
             {
-                Frame frame = new Frame(flags, type, track, channel, _useDirect ? ByteBuffer.allocateDirect(0)
: ByteBuffer.allocate(0));
+                Frame frame = new Frame(flags, type, track, channel, EMPTY_BYTE_BUFFER);
                 receiver.received(frame);
                 needed = Frame.HEADER_SIZE;
                 return FRAME_HDR;



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message