You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by kw...@apache.org on 2015/10/05 12:27:00 UTC
svn commit: r1706787 -
/qpid/java/trunk/common/src/main/java/org/apache/qpid/bytebuffer/QpidByteBuffer.java
Author: kwall
Date: Mon Oct 5 10:27:00 2015
New Revision: 1706787
URL: http://svn.apache.org/viewvc?rev=1706787&view=rev
Log:
QPID-6770: Prevent chains of DirectByteBuffers forming when slicing the thread-local cached buffer
Modified:
qpid/java/trunk/common/src/main/java/org/apache/qpid/bytebuffer/QpidByteBuffer.java
Modified: qpid/java/trunk/common/src/main/java/org/apache/qpid/bytebuffer/QpidByteBuffer.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/common/src/main/java/org/apache/qpid/bytebuffer/QpidByteBuffer.java?rev=1706787&r1=1706786&r2=1706787&view=diff
==============================================================================
--- qpid/java/trunk/common/src/main/java/org/apache/qpid/bytebuffer/QpidByteBuffer.java (original)
+++ qpid/java/trunk/common/src/main/java/org/apache/qpid/bytebuffer/QpidByteBuffer.java Mon Oct 5 10:27:00 2015
@@ -479,8 +479,7 @@ public final class QpidByteBuffer
QpidByteBuffer rVal = buf.view(0, size);
buf.position(buf.position() + size);
- _cachedBuffer.set(buf.slice());
- buf.dispose();
+ _cachedBuffer.set(buf);
return rVal;
}
}
@@ -516,8 +515,15 @@ public final class QpidByteBuffer
buffers.add(buf.view(0, remaining));
buf.position(buf.position() + remaining);
- _cachedBuffer.set(buf.hasRemaining() ? buf.slice() : allocateDirect(_pooledBufferSize));
- buf.dispose();
+ if (buf.hasRemaining())
+ {
+ _cachedBuffer.set(buf);
+ }
+ else
+ {
+ _cachedBuffer.set(allocateDirect(_pooledBufferSize));
+ buf.dispose();
+ }
return buffers;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org