qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kw...@apache.org
Subject svn commit: r1643363 - in /qpid/branches/QPID-6262-JavaBrokerNIO/qpid/java: broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/ systests/src/test/java/org/apache/qpid/client/
Date Fri, 05 Dec 2014 17:30:06 GMT
Author: kwall
Date: Fri Dec  5 17:30:06 2014
New Revision: 1643363

URL: http://svn.apache.org/r1643363
Log:
Bug fix: Stop 0-8 protocol layer wrapping the same byte array

Modified:
    qpid/branches/QPID-6262-JavaBrokerNIO/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQProtocolEngine.java
    qpid/branches/QPID-6262-JavaBrokerNIO/qpid/java/systests/src/test/java/org/apache/qpid/client/AMQQueueDeferredOrderingTest.java

Modified: qpid/branches/QPID-6262-JavaBrokerNIO/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQProtocolEngine.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-6262-JavaBrokerNIO/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQProtocolEngine.java?rev=1643363&r1=1643362&r2=1643363&view=diff
==============================================================================
--- qpid/branches/QPID-6262-JavaBrokerNIO/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQProtocolEngine.java
(original)
+++ qpid/branches/QPID-6262-JavaBrokerNIO/qpid/java/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQProtocolEngine.java
Fri Dec  5 17:30:06 2014
@@ -514,20 +514,10 @@ public class AMQProtocolEngine implement
             throw new ServerScopedRuntimeException(e);
         }
 
-        final ByteBuffer buf;
-
-        if(size <= REUSABLE_BYTE_BUFFER_CAPACITY)
-        {
-            buf = _reusableByteBuffer;
-            buf.position(0);
-        }
-        else
-        {
-            buf = ByteBuffer.wrap(data);
-        }
-        buf.limit(_reusableDataOutput.length());
-
-        return buf;
+        final ByteBuffer copy = ByteBuffer.allocate(_reusableDataOutput.length());
+        copy.put(data, 0, _reusableDataOutput.length());
+        copy.flip();
+        return copy;
     }
 
 

Modified: qpid/branches/QPID-6262-JavaBrokerNIO/qpid/java/systests/src/test/java/org/apache/qpid/client/AMQQueueDeferredOrderingTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/QPID-6262-JavaBrokerNIO/qpid/java/systests/src/test/java/org/apache/qpid/client/AMQQueueDeferredOrderingTest.java?rev=1643363&r1=1643362&r2=1643363&view=diff
==============================================================================
--- qpid/branches/QPID-6262-JavaBrokerNIO/qpid/java/systests/src/test/java/org/apache/qpid/client/AMQQueueDeferredOrderingTest.java
(original)
+++ qpid/branches/QPID-6262-JavaBrokerNIO/qpid/java/systests/src/test/java/org/apache/qpid/client/AMQQueueDeferredOrderingTest.java
Fri Dec  5 17:30:06 2014
@@ -39,7 +39,7 @@ public class AMQQueueDeferredOrderingTes
     private Session session;
     private AMQQueue queue;
     private MessageConsumer consumer;
-    private int numMessages;
+    private int _numMessages;
 
     private static final Logger _logger = LoggerFactory.getLogger(AMQQueueDeferredOrderingTest.class);
 
@@ -86,7 +86,7 @@ public class AMQQueueDeferredOrderingTes
     {
         super.setUp();
 
-        numMessages = isBrokerStorePersistent() ? 300 : 1000;
+        _numMessages = isBrokerStorePersistent() ? 300 : 1000;
 
         _logger.info("Create Connection");
         con = getConnection();
@@ -106,30 +106,33 @@ public class AMQQueueDeferredOrderingTes
 
         // Setup initial messages
         _logger.info("Creating first producer thread");
-        producerThread = new ASyncProducer(queue, 0, numMessages / 2);
+        producerThread = new ASyncProducer(queue, 0, _numMessages / 2);
         producerThread.start();
         // Wait for them to be done
         producerThread.join();
 
         // Setup second set of messages to produce while we consume
         _logger.info("Creating second producer thread");
-        producerThread = new ASyncProducer(queue, numMessages / 2, numMessages);
+        producerThread = new ASyncProducer(queue, _numMessages / 2, _numMessages);
         producerThread.start();
 
         // Start consuming and checking they're in order
         _logger.info("Consuming messages");
-        for (int i = 0; i < numMessages; i++)
+        for (int i = 0; i < _numMessages; i++)
         {
             Message msg = consumer.receive(3000);
+
+            _logger.debug("KWDEBUG got " + msg);
+
             assertNotNull("Message " + i + " should not be null", msg);
             assertTrue("Message " + i + " should be a text message", msg instanceof TextMessage);
-            assertEquals("Message content " + i + "does not match expected", Integer.toString(i),
((TextMessage) msg).getText());
+            assertEquals("Message content " + i + " does not match expected", Integer.toString(i),
((TextMessage) msg).getText());
         }
     }
 
     protected void tearDown() throws Exception
     {
-        _logger.info("Interuptting producer thread");
+        _logger.info("Interrupting producer thread");
         producerThread.interrupt();
         _logger.info("Closing connection");
         con.close();



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


Mime
View raw message