对于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;
}
}发布于 2013-01-04 05:32:42
那是个bug..我会修复3.6.2的fix,因为3.6.1的发布过程已经开始了。
在此期间,你可以直接“克隆”这个类,然后把它交给我们:
public final class ImmediateExecutor implements Executor {
/**
* The default instance.
*/
public static final ImmediateExecutor INSTANCE = new ImmediateExecutor();
public void execute(Runnable command) {
command.run();
}
}https://stackoverflow.com/questions/14142814
复制相似问题