normanmaurer commented on a change in pull request #753: ZOOKEEPER-3204:
Reconfig tests are constantly failing on 3.5 after applying Java 11 fix
URL: https://github.com/apache/zookeeper/pull/753#discussion_r254267679
##########
File path:
zookeeper-server/src/main/java/org/apache/zookeeper/server/NettyServerCnxn.java
##########
@@ -303,19 +277,126 @@ private boolean checkFourLetterWord(final Channel
channel,
}
}
- public void receiveMessage(ChannelBuffer message) {
+ /**
+ * Process incoming message. This should only be called from the event
+ * loop thread.
+ * @param buf the message bytes to process.
+ */
+ void processMessage(ByteBuf buf) {
+ assert channel.eventLoop().inEventLoop();
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("0x{} queuedBuffer: {}",
+ Long.toHexString(sessionId),
+ queuedBuffer);
+ }
+
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("0x{} buf {}",
+ Long.toHexString(sessionId),
+ ByteBufUtil.hexDump(buf));
+ }
+
+ if (throttled.get()) {
+ LOG.debug("Received message while throttled");
+ // we are throttled, so we need to queue
+ if (queuedBuffer == null) {
+ LOG.debug("allocating queue");
+ queuedBuffer = channel.alloc().buffer(buf.readableBytes());
Review comment:
Another thing you could do is to not allocate at all but call
`buf.retainedDuplicate()` and store a reference to the returned duplicate
directly. You can then still write into this one later if needed.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services