bschuchardt commented on a change in pull request #6343:
URL: https://github.com/apache/geode/pull/6343#discussion_r617758447
##########
File path:
geode-core/src/main/java/org/apache/geode/internal/tcp/Connection.java
##########
@@ -1617,8 +1612,18 @@ private void readMessages() {
break;
}
- try {
- ByteBuffer buff = getInputBuffer();
+ try (final ByteBufferSharing inputSharing = inputBufferVendor.open()) {
Review comment:
If this buffer is being used for TLS doesn't it need to remain the
packet size dictated by the SSLSession? Maybe createIOFilter should set
recvBufferSize to the packet size so that this code won't expand the buffer.
##########
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:
this method is only invoked in processInputBuffer, where it's already in
a "try" block. Since this is in the primary execution path for all incoming
messages I think it would be good to avoid having this extraneous "try" block.
--
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]