/** * * @param server */ private void destoryServlets(HttpServer server) { if (servletHandlers != null && !servletHandlers.isEmpty()) { ServerConfiguration config = server.getServerConfiguration(); for (final ServletHandler handler : servletHandlers) { config.removeHttpHandler(handler); } } }
/** * * @param server */ private void destoryServlets(HttpServer server) { if (servletHandlers != null && !servletHandlers.isEmpty()) { ServerConfiguration config = server.getServerConfiguration(); for (final ServletHandler handler : servletHandlers) { config.removeHttpHandler(handler); } } }
/** * * @param server */ private void destoryServlets(HttpServer server) { if (servletHandlers != null && !servletHandlers.isEmpty()) { ServerConfiguration config = server.getServerConfiguration(); for (final ServletHandler handler : servletHandlers) { config.removeHttpHandler(handler); } } }
/** * * @param server */ private void destoryServlets(HttpServer server) { if (servletHandlers != null && !servletHandlers.isEmpty()) { ServerConfiguration config = server.getServerConfiguration(); for (final ServletHandler handler : servletHandlers) { config.removeHttpHandler(handler); } } }
/** * * @param server */ private void destoryServlets(HttpServer server) { if (servletHandlers != null && !servletHandlers.isEmpty()) { ServerConfiguration config = server.getServerConfiguration(); for (final ServletHandler handler : servletHandlers) { config.removeHttpHandler(handler); } } }
/** * * @param server */ private void destoryServlets(HttpServer server) { if (servletHandlers != null && !servletHandlers.isEmpty()) { ServerConfiguration config = server.getServerConfiguration(); for (final ServletHandler handler : servletHandlers) { config.removeHttpHandler(handler); } } }
@Override public <T> Flowable<RpcInvocation<T>> requests(String destination, Class<T> targetType) { URL destinationAsLocalUrl; try { destinationAsLocalUrl = new URL("http", "localhost", destination); } catch (MalformedURLException e) { throw new RuntimeException(e); } Flowable retVal = mapDestinationToIncomingMessages .computeIfAbsent(destination, key -> { logger.info("Listening to requests on " + destination); Subject<RpcInvocation> stream = PublishSubject.create(); stream = stream.toSerialized(); NonBlockingHttpHandler httpHandler = new NonBlockingHttpHandler(destinationAsLocalUrl, messageTranscriber, targetType, stream); httpServer.getServerConfiguration().addHttpHandler(httpHandler, destination); return stream.toFlowable(BackpressureStrategy.BUFFER) .doFinally(() -> { mapDestinationToIncomingMessages.remove(destination); httpServer.getServerConfiguration().removeHttpHandler(httpHandler); logger.info("Stopped listening to requests on " + destination); }) .share(); }); return retVal; }
/** * Unpublish a service. * @param sid The service identifier. */ public IFuture<Void> unpublishService(IServiceIdentifier sid) { Future<Void> ret = new Future<Void>(); boolean stopped = false; if(sidservers!=null) { Tuple2<HttpServer, HttpHandler> tup = sidservers.remove(sid); if(tup!=null) { HttpServer server = tup.getFirstEntity(); ServerConfiguration config = server.getServerConfiguration(); config.removeHttpHandler(tup.getSecondEntity()); if(config.getHttpHandlers().size()==0) server.stop(); stopped = true; ret.setResult(null); } } if(!stopped) ret.setException(new RuntimeException("Published service could not be stopped: "+sid)); return ret; }