You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2022/07/01 03:09:29 UTC

[GitHub] [rocketmq] lizhanhui commented on a diff in pull request #4534: [issue #4533]fix NettyEventExecutor.putNettyEvent() to make it thread…

lizhanhui commented on code in PR #4534:
URL: https://github.com/apache/rocketmq/pull/4534#discussion_r911580940


##########
remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingAbstract.java:
##########
@@ -567,15 +567,12 @@ public void operationComplete(ChannelFuture f) throws Exception {
     }
 
     class NettyEventExecutor extends ServiceThread {
-        private final LinkedBlockingQueue<NettyEvent> eventQueue = new LinkedBlockingQueue<NettyEvent>();
         private final int maxSize = 10000;
+        private final LinkedBlockingQueue<NettyEvent> eventQueue = new LinkedBlockingQueue<NettyEvent>();
 
         public void putNettyEvent(final NettyEvent event) {
-            int currentSize = this.eventQueue.size();
-            if (currentSize <= maxSize) {
-                this.eventQueue.add(event);
-            } else {
-                log.warn("event queue size [{}] over the limit [{}], so drop this event {}", currentSize, maxSize, event.toString());
+            if (!eventQueue.offer(event)) {

Review Comment:
   eventQueue is not bounded... it never fails...and this breaks the current trade-off impl I mentioned in the issue



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

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org