0

对于 ssl 握手超时示例,如何调用 ImmediateExecutor.INSTANCE 因为它是包保护的

final Timer timer = new HashedWheelTimer();

final SslBufferPool pool = new SslBufferPool();


final class MyChannelPipelineFactory implements ChannelPipelineFactory {

public ChannelPipeline getPipeline() {

ChannelPipeline cp = Channels.pipeline();



SslEngine engine = ...

// Use a handshake timeout of 10 seconds

SslHandler handler = new SslHandler(engine, pool, false, ImmediateExecutor.INSTANCE, timer, 10000);

cp.addFirst("ssl", handler);

return cp;

}
}
4

1 回答 1

0

那是一个错误。我将为 3.6.2.Final 修复它,因为 3.6.1.Final 的发布过程已经开始。

同时,您可以“克隆”该类并使用它:

public final class ImmediateExecutor implements Executor {

    /**
     * The default instance.
     */
    public static final ImmediateExecutor INSTANCE = new ImmediateExecutor();

    public void execute(Runnable command) {
        command.run();
    }
}
于 2013-01-03T21:32:42.170 回答