【发布时间】:2013-02-01 16:08:30
【问题描述】:
我正在尝试从我的处理程序管道中删除某个处理程序,但我在执行此操作时遇到了麻烦。当我列出前后管道中的处理程序时,我试图删除的处理程序仍然存在。那么我在这里做错了什么?这是一个代码sn-p。所有这些都处于启动阶段。你可以看到我做的最后一件事是配置管道工厂。我正在使用 Netty 3.6.1.final。
List<String> handlers = new ArrayList<String>();
// list handlers in the pipeline
try {
handlers = this.pipelineFactory.getPipeline().getNames();
for (int len = handlers.size(), i = 0; i < len; i++) {
String s = handlers.get(i);
System.out.println("Item " + i + " is " + s);
}
} catch( Exception e ) {}
try {
System.out.println("Remove hexdump");
this.pipelineFactory.getPipeline().remove("hexdump");
} catch( Exception e ) {
System.out.println("error = " + e.getMessage());
}
try {
handlers = this.pipelineFactory.getPipeline().getNames();
for (int len = handlers.size(), i = 0; i < len; i++) {
String s = handlers.get(i);
System.out.println("Item " + i + " is " + s);
}
} catch( Exception e ) {}
// Configure the pipeline factory.
this.bootstrap.setPipelineFactory(this.pipelineFactory);
这是输出:
Item 0 is framer
Item 1 is hexdump
Item 2 is handler
Remove hexdump
Item 0 is framer
Item 1 is hexdump
Item 2 is handler
【问题讨论】: