bschuchardt commented on a change in pull request #6219:
URL: https://github.com/apache/geode/pull/6219#discussion_r604162869



##########
File path: 
geode-core/src/main/java/org/apache/geode/internal/tcp/Connection.java
##########
@@ -2643,17 +2633,21 @@ void writeFully(SocketChannel channel, ByteBuffer 
buffer, boolean forceAsync,
   }
 
   /**
-   * gets the buffer for receiving message length bytes
+   * Called from constructors to initialize inputSharing
    */
-  private ByteBuffer getInputBuffer() {
-    if (inputBuffer == null) {
-      int allocSize = recvBufferSize;
-      if (allocSize == -1) {
-        allocSize = owner.getConduit().tcpBufferSize;
-      }
-      inputBuffer = getBufferPool().acquireDirectReceiveBuffer(allocSize);
+  private void initializeInputSharing() {
+    int allocSize = recvBufferSize;
+    if (allocSize == -1) {
+      allocSize = owner.getConduit().tcpBufferSize;
     }
-    return inputBuffer;
+    inputSharing = new ByteBufferSharingImpl(
+        getBufferPool().acquireDirectReceiveBuffer(allocSize),
+        BufferPool.BufferType.TRACKED_RECEIVER,
+        getBufferPool());
+  }
+
+  private ByteBufferSharing shareInputBuffer() throws IOException {

Review comment:
       since you're using inputSharing.close() everywhere you could similarly 
use inputSharing.close() instead of putting it in this method.  That might be 
easier to follow.




-- 
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