老师您好,问题如标题所示,虽然这段代码上有说明,但是我看得一知半解,它这么做的目的好像是为了确保用户自定义的handler在pipline中的位置比ServerBootstrapAcceptor靠前,但是这一点是怎么保证的呢?
// We add this handler via the EventLoop as the user may have used a ChannelInitializer as handler.
// In this case the initChannel(...) method will only be called after this method returns. Because
// of this we need to ensure we add our handler in a delayed fashion so all the users handler are
// placed in front of the ServerBootstrapAcceptor.
ch.eventLoop().execute(new Runnable() {
@Override
public void run() {
pipeline.addLast(new ServerBootstrapAcceptor(
currentChildGroup, currentChildHandler, currentChildOptions, currentChildAttrs));
}
});