private void actualClose(final ContextInternal closeContext, final Handler<AsyncResult<Void>> done) { if (id != null) { vertx.sharedHttpServers().remove(id); } ContextInternal currCon = vertx.getContext(); for (ConnectionBase conn : connectionMap.values()) { conn.close(); } // Sanity check if (vertx.getContext() != currCon) { throw new IllegalStateException("Context was changed"); } if (metrics != null) { metrics.close(); } ChannelGroupFuture fut = serverChannelGroup.close(); fut.addListener(cgf -> executeCloseDone(closeContext, done, fut.cause())); }
synchronized (vertx.sharedHttpServers()) { this.actualPort = port; // Will be updated on bind for a wildcard port id = new ServerID(port, host); HttpServerImpl shared = vertx.sharedHttpServers().get(id); if (shared == null || port == 0) { serverChannelGroup = new DefaultChannelGroup("vertx-acceptor-channels", GlobalEventExecutor.INSTANCE); bindFuture.addListener(res -> { if (res.failed()) { vertx.sharedHttpServers().remove(id); } else { Channel serverChannel = res.result(); return this; vertx.sharedHttpServers().put(id, this); actualServer = this; } else {
synchronized (vertx.sharedHttpServers()) {
private void actualClose(final ContextInternal closeContext, final Handler<AsyncResult<Void>> done) { if (id != null) { vertx.sharedHttpServers().remove(id); } ContextInternal currCon = vertx.getContext(); for (ConnectionBase conn : connectionMap.values()) { conn.close(); } // Sanity check if (vertx.getContext() != currCon) { throw new IllegalStateException("Context was changed"); } if (metrics != null) { metrics.close(); } ChannelGroupFuture fut = serverChannelGroup.close(); fut.addListener(cgf -> executeCloseDone(closeContext, done, fut.cause())); }
synchronized (vertx.sharedHttpServers()) { this.actualPort = port; // Will be updated on bind for a wildcard port id = new ServerID(port, host); HttpServerImpl shared = vertx.sharedHttpServers().get(id); if (shared == null || port == 0) { serverChannelGroup = new DefaultChannelGroup("vertx-acceptor-channels", GlobalEventExecutor.INSTANCE); bindFuture.addListener(res -> { if (res.failed()) { vertx.sharedHttpServers().remove(id); } else { Channel serverChannel = res.result(); return this; vertx.sharedHttpServers().put(id, this); actualServer = this; } else {
synchronized (vertx.sharedHttpServers()) {
@Override public void process(CommandProcess process) { VertxInternal vertx = (VertxInternal) process.vertx(); process.write("\nNet Servers:\n"); for (Map.Entry<ServerID, NetServerImpl> server : vertx.sharedNetServers().entrySet()) { process.write(server.getKey().host + ":" + server.getKey().port + "\n"); } process.write("\nHTTP Servers:\n"); for (Map.Entry<ServerID, HttpServerImpl> server : vertx.sharedHttpServers().entrySet()) { process.write(server.getKey().host + ":" + server.getKey().port + "\n"); } process.end(); } }