Bill commented on a change in pull request #6343:
URL: https://github.com/apache/geode/pull/6343#discussion_r618690898



##########
File path: 
geode-core/src/main/java/org/apache/geode/internal/tcp/Connection.java
##########
@@ -3228,28 +3221,23 @@ private void setThreadName(int dominoNumber) {
         + " local port=" + socket.getLocalPort() + " remote port=" + 
socket.getPort());
   }
 
-  private void compactOrResizeBuffer(int messageLength) {
-    final int oldBufferSize = inputBuffer.capacity();
-    int allocSize = messageLength + MSG_HEADER_BYTES;
-    if (oldBufferSize < allocSize) {
-      // need a bigger buffer
-      logger.info("Allocating larger network read buffer, new size is {} old 
size was {}.",
-          allocSize, oldBufferSize);
-      ByteBuffer oldBuffer = inputBuffer;
-      inputBuffer = getBufferPool().acquireDirectReceiveBuffer(allocSize);
-
-      if (oldBuffer != null) {
-        int oldByteCount = oldBuffer.remaining();
-        inputBuffer.put(oldBuffer);
-        inputBuffer.position(oldByteCount);
-        getBufferPool().releaseReceiveBuffer(oldBuffer);
-      }
-    } else {
-      if (inputBuffer.position() != 0) {
-        inputBuffer.compact();
+  private void compactOrResizeBuffer(int messageLength) throws IOException {
+    try (final ByteBufferSharing inputSharing = inputBufferVendor.open()) {

Review comment:
       inlining this method in my next commit…




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to