ivmaykov 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_r254331186
##########
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:
This was me trying to preserve the original behavior as much as possible
while doing the netty3 -> netty4 conversion. But some good ideas here, I'll
look into optimizing it in a follow-up.
----------------------------------------------------------------
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