Hello!
I"m using grizzly-nio-framework + http-webserver (both are v1.9.14), my goal
is to run the code below on more than one port.
So I need to bind, let us say, the port1 to the parserFilter1 and port2 to
parserFilter2 (this should be two different protocols (both on top of the
tcp, one is a http and another ist the own one)). Than these protocols
should share the same Filters (RequestControllerFilter &
ProcessRequestFilter). How could I implement this?
Thank you in advance,
alaska
public void start() throws Exception {
final ProtocolFilter parserFilter1 = new
AsciiCommandProtocolParserFilter();
final ProtocolFilter reqcontrolFilter = new
RequestControllerFilter();
final Controller controller = new Controller();
final TCPSelectorHandler tcp_handler = new TCPSelectorHandler();
tcp_handler.setPort(PORT1);
tcp_handler.setSelectionKeyHandler(new BaseSelectionKeyHandler());
controller.addSelectorHandler(tcp_handler);
controller.setReadThreadsCount(_selectorThreadsNumber);
final ProtocolChain protocolChain = new DefaultProtocolChain();
protocolChain.addFilter(parserFilter1);
protocolChain.addFilter(reqcontrolFilter);
protocolChain.addFilter(new ProcessRequestFilter());
((DefaultProtocolChain) protocolChain).setContinuousExecution(true);
ProtocolChainInstanceHandler pciHandler = new
DefaultProtocolChainInstanceHandler() {
@Override
public ProtocolChain poll() {
return protocolChain;
}
@Override
public boolean offer(ProtocolChain pc) {
return false;
}
};
controller.setProtocolChainInstanceHandler(pciHandler);
try {
controller.start();
} catch (Exception e) {
LOG.log(Level.SEVERE, "Exception in controller...", e);
}
}
--
View this message in context: http://www.nabble.com/Running-Grizzly-nio-at-more-than-one-port-tp24459570p24459570.html
Sent from the Grizzly - Users mailing list archive at Nabble.com.