serverChannelGroup.add(serverChannel);
bindFuture.addListener(channelFuture -> {
if (!channelFuture.isSuccess()) {
vertx.sharedHttpServers().remove(id);
} else {
metrics.listening(new SocketAddressImpl(options.getPort(), options.getHost()));
}
});
} catch (final Throwable t) {
// Make sure we send the exception back through the handler (if any)
if (listenHandler != null) {
vertx.runOnContext(v -> listenHandler.handle(Future.completedFuture(t)));
} else {
// No handler - log so user can see failure
log.error(t);
}
listening = false;
return this;
}
vertx.sharedHttpServers().put(id, this);
actualServer = this;
} else {
// Server already exists with that host/port - we will use that
actualServer = shared;
addHandlers(actualServer, listenContext);
metrics.listening(new SocketAddressImpl(options.getPort(), options.getHost()));
}
actualServer.bindFuture.addListener(future -> {
if (listenHandler != null) {
final AsyncResult<HttpServer> res;
if (future.isSuccess()) {