netty中的非IO线程可以执行GenericFutureListener.operationComplete吗

时间:2018-10-02 08:20:50

标签: java netty

来自ChannelFutureListener文档:

  

GenericFutureListener.operationComplete(Future)直接由   一个I / O线程

我阅读了netty 4.1.22的最终源代码。看来GenericFutureListener.operationComplete可以在调用addListeners()的线程(非IO线程)中执行 事件结束后,但尚未调用侦听器。

public String superDigit(String s, int n) {
    Integer newString = 0;
    //just in case the string is really really long
    for(int i = 0; i <= n ; ++i) { 
        newString = valueOf(s, 10);  //<-- this line has an error (stated above)
        setOutput(Integer.toString(firstOutput(newString)));
    }
    return s;
}

1 个答案:

答案 0 :(得分:0)

它将始终由用于创建EventExecutor的{​​{1}}执行。 DefaultPromiseEventLoop的子类型,大多数时候都用来创建这样的EventExecutor