handler = new ServerHandler(cfgCtx, params, sslContext != null, metrics, parser, executor);
final IOEventDispatch ioEventDispatch = getEventDispatch(handler,
sslContext, sslIOSessionHandler, params);
state = BaseConstants.STARTED;
ListenerEndpoint endpoint;
try {
if (bindAddress == null) {
endpoint = ioReactor.listen(new InetSocketAddress(port));
} else {
endpoint = ioReactor.listen(new InetSocketAddress(
InetAddress.getByName(bindAddress), port));
}
} catch (IOException e) {
handleException("Encountered an I/O error: " + e.getMessage(), e);
return;
}
// start the IO reactor in a new separate thread
Thread t = new Thread(new Runnable() {
public void run() {
try {
ioReactor.execute(ioEventDispatch);
} catch (InterruptedIOException ex) {
log.fatal("Reactor Interrupted", ex);
} catch (IOException e) {
log.fatal("Encountered an I/O error: " + e.getMessage(), e);
} catch (Exception e) {
log.fatal("Unexpected exception in I/O reactor", e);
}
log.info((sslContext == null ? "HTTP" : "HTTPS") + " Listener Shutdown");
}
}, "HttpCoreNIOListener");
t.start();
// Wait for the endpoint to become ready, i.e. for the listener to start accepting
// requests.
try {
endpoint.waitFor();
} catch (InterruptedException e) {
log.warn("HttpCoreNIOListener#start() was interrupted");
}
log.info((sslContext == null ? "HTTP" : "HTTPS") + " Listener started on" +