Skip to content

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

@zeroFruit

Description

@zeroFruit
      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

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions