Я пытаюсь удалить определенный обработчик из моего конвейера обработчиков, но у меня возникают проблемы с этим. Когда я перечисляю обработчики в конвейере до и после, обработчик, который я пытался удалить, все еще там. Так что я делаю неправильно здесь? Вот фрагмент кода. Все это находится в стадии запуска. Как видите, последнее, что я делаю, — это настраиваю фабрику конвейеров. Я использую 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