Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When register() eventLoop on the channel, waiting for all handlers done its event handling? #74

Open
zeroFruit opened this issue May 28, 2022 · 0 comments
Labels
question Further information is requested

Comments

@zeroFruit
Copy link
Owner

      ChannelEventLoop eventLoop = mock(ChannelEventLoop.class);
      when(eventLoop.inEventLoop()).thenReturn(true);
      TestInboundHandler handler = new TestInboundHandler() {
        @Override
        public void channelRegistered(ChannelHandlerContext ctx) throws Exception {
          latch.countDown();
        }
      };

      TestChannel channel = new TestChannel();
      channel.pipeline().addLast(handler);

      ChannelPromise promise = new DefaultChannelPromise(channel, eventLoop);
      channel.internal().register(eventLoop, promise);
      promise.await();

When promise.await() is done, someone might expect all event handler calls done successfully. But in the code, registering the event loop on the channel and calling all event handlers are asynchronous. So although promise is done with success, some event handlers could be failed

@zeroFruit zeroFruit added the question Further information is requested label May 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant