@Override public void run() { node.getConnectionPool().connect(null, exchange, new ProxyCallback<ProxyConnection>() { @Override public void completed(final HttpServerExchange exchange, ProxyConnection result) { final RequestExchangeListener exchangeListener = new RequestExchangeListener(callback, NodeHealthChecker.NO_CHECK, false); exchange.dispatch(SameThreadExecutor.INSTANCE, new ConnectionPoolPingTask(result, exchangeListener, node.getNodeConfig().getConnectionURI())); // Schedule timeout task scheduleCancelTask(exchange.getIoThread(), exchangeListener, timeout, TimeUnit.SECONDS); } @Override public void failed(HttpServerExchange exchange) { callback.failed(); } @Override public void queuedRequestFailed(HttpServerExchange exchange) { callback.failed(); } @Override public void couldNotResolveBackend(HttpServerExchange exchange) { callback.failed(); } }, timeout, TimeUnit.SECONDS, false); } });
/** * Handle a proxy request for this context. * * @param target the proxy target * @param exchange the http server exchange * @param callback the proxy callback * @param timeout the timeout * @param timeUnit the time unit * @param exclusive whether this connection is exclusive */ void handleRequest(final ModClusterProxyTarget target, final HttpServerExchange exchange, final ProxyCallback<ProxyConnection> callback, long timeout, TimeUnit timeUnit, boolean exclusive) { if (addRequest()) { exchange.addExchangeCompleteListener(new ExchangeCompletionListener() { @Override public void exchangeEvent(HttpServerExchange exchange, NextListener nextListener) { requestDone(); nextListener.proceed(); } }); node.getConnectionPool().connect(target, exchange, callback, timeout, timeUnit, exclusive); } else { callback.failed(exchange); } }
@Override public void run() { node.getConnectionPool().connect(null, exchange, new ProxyCallback<ProxyConnection>() { @Override public void completed(final HttpServerExchange exchange, ProxyConnection result) { final RequestExchangeListener exchangeListener = new RequestExchangeListener(callback, NodeHealthChecker.NO_CHECK, false); exchange.dispatch(SameThreadExecutor.INSTANCE, new ConnectionPoolPingTask(result, exchangeListener, node.getNodeConfig().getConnectionURI())); // Schedule timeout task scheduleCancelTask(exchange.getIoThread(), exchangeListener, timeout, TimeUnit.SECONDS); } @Override public void failed(HttpServerExchange exchange) { callback.failed(); } @Override public void queuedRequestFailed(HttpServerExchange exchange) { callback.failed(); } @Override public void couldNotResolveBackend(HttpServerExchange exchange) { callback.failed(); } }, timeout, TimeUnit.SECONDS, false); } });
@Override public void run() { node.getConnectionPool().connect(null, exchange, new ProxyCallback<ProxyConnection>() { @Override public void completed(final HttpServerExchange exchange, ProxyConnection result) { final RequestExchangeListener exchangeListener = new RequestExchangeListener(callback, NodeHealthChecker.NO_CHECK, false); exchange.dispatch(SameThreadExecutor.INSTANCE, new ConnectionPoolPingTask(result, exchangeListener, node.getNodeConfig().getConnectionURI())); // Schedule timeout task scheduleCancelTask(exchange.getIoThread(), exchangeListener, timeout, TimeUnit.SECONDS); } @Override public void failed(HttpServerExchange exchange) { callback.failed(); } @Override public void queuedRequestFailed(HttpServerExchange exchange) { callback.failed(); } @Override public void couldNotResolveBackend(HttpServerExchange exchange) { callback.failed(); } }, timeout, TimeUnit.SECONDS, false); } });
/** * Handle a proxy request for this context. * * @param target the proxy target * @param exchange the http server exchange * @param callback the proxy callback * @param timeout the timeout * @param timeUnit the time unit * @param exclusive whether this connection is exclusive */ void handleRequest(final ModClusterProxyTarget target, final HttpServerExchange exchange, final ProxyCallback<ProxyConnection> callback, long timeout, TimeUnit timeUnit, boolean exclusive) { if (addRequest()) { exchange.addExchangeCompleteListener(new ExchangeCompletionListener() { @Override public void exchangeEvent(HttpServerExchange exchange, NextListener nextListener) { requestDone(); nextListener.proceed(); } }); node.getConnectionPool().connect(target, exchange, callback, timeout, timeUnit, exclusive); } else { callback.failed(exchange); } }
/** * Handle a proxy request for this context. * * @param target the proxy target * @param exchange the http server exchange * @param callback the proxy callback * @param timeout the timeout * @param timeUnit the time unit * @param exclusive whether this connection is exclusive */ void handleRequest(final ModClusterProxyTarget target, final HttpServerExchange exchange, final ProxyCallback<ProxyConnection> callback, long timeout, TimeUnit timeUnit, boolean exclusive) { if (addRequest()) { exchange.addExchangeCompleteListener(new ExchangeCompletionListener() { @Override public void exchangeEvent(HttpServerExchange exchange, NextListener nextListener) { requestDone(); nextListener.proceed(); } }); node.getConnectionPool().connect(target, exchange, callback, timeout, timeUnit, exclusive); } else { callback.failed(exchange); } }