@Override public void close() { connection.close(); }
@Override public void succeeded(Connection connection) { connection.send(request, listener); }
@Override public boolean isClosed() { return connection.isClosed(); } }
public void close() { for (Connection connection : idleConnections) connection.close(); idleConnections.clear(); // A bit drastic, but we cannot wait for all requests to complete for (Connection connection : activeConnections) connection.close(); activeConnections.clear(); abort(new AsynchronousCloseException()); connectionCount.set(0); LOG.debug("Closed {}", this); }
.header(HttpHeader.HOST.asString(), target) .timeout(client.getConnectTimeout(), TimeUnit.MILLISECONDS); connection.send(connect, new Response.CompleteListener()
public void close() { for (Connection connection : idleConnections) connection.close(); idleConnections.clear(); // A bit drastic, but we cannot wait for all requests to complete for (Connection connection : activeConnections) connection.close(); activeConnections.clear(); abort(new AsynchronousCloseException()); connectionCount.set(0); LOG.debug("Closed {}", this); }
.header(HttpHeader.HOST.asString(), target) .timeout(client.getConnectTimeout(), TimeUnit.MILLISECONDS); connection.send(connect, new Response.CompleteListener()
public void release(Connection connection) { LOG.debug("{} released", connection); if (client.isRunning()) { boolean removed = activeConnections.remove(connection); if (removed) process(connection, false); else LOG.debug("{} explicit", connection); } else { LOG.debug("{} is stopped", client); remove(connection); connection.close(); } }
connection.send(connect, result ->
public void release(Connection connection) { LOG.debug("{} released", connection); if (client.isRunning()) { boolean removed = activeConnections.remove(connection); if (removed) process(connection, false); else LOG.debug("{} explicit", connection); } else { LOG.debug("{} is stopped", client); remove(connection); connection.close(); } }
Connection connection = (Connection)request.getAttributes().get(Connection.class.getName()); if (connection != null) connection.send(newRequest, listener); else newRequest.send(listener);
@Override public void onComplete(Result result) { if (result.isFailed()) { failed(result.getFailure()); connection.close(); } else { Response response = result.getResponse(); if (response.getStatus() == 200) { delegate.succeeded(connection); } else { failed(new HttpResponseException("Received " + response + " for " + result.getRequest(), response)); connection.close(); } } } });
@Override public void onComplete(Result result) { if (result.isFailed()) { failed(result.getFailure()); connection.close(); } else { Response response = result.getResponse(); if (response.getStatus() == 200) { delegate.succeeded(connection); } else { failed(new HttpResponseException("Received " + response + " for " + result.getRequest(), response)); connection.close(); } } } });
public void release(Connection connection) { if (LOG.isDebugEnabled()) LOG.debug("Released {}", connection); HttpClient client = getHttpClient(); if (client.isRunning()) { if (connectionPool.isActive(connection)) { if (connectionPool.release(connection)) send(); else connection.close(); } else { if (LOG.isDebugEnabled()) LOG.debug("Released explicit {}", connection); } } else { if (LOG.isDebugEnabled()) LOG.debug("{} is stopped", client); connection.close(); } }