void returnConnection(final ClientConnection conn) { if (!conn.keepAlive) { // Close it conn.internalClose(); } else { pool.returnConnection(conn); } }
void getConnection(Handler<ClientConnection> handler, long contextID) { pool.getConnection(handler, contextID); }
/** Returns the maximum number of connections in the pool */ public int getMaxPoolSize() { return pool.getMaxPoolSize(); }
/** Close the HTTP client. This will cause any pooled HTTP connections to be closed. */ public void close() { pool.close(); for (ClientConnection conn : connectionMap.values()) { conn.internalClose(); } }
/** * Set the maximum pool size to the value specified by {@code maxConnections} * * <p>The client will maintain up to {@code maxConnections} HTTP connections in an internal pool * * <p> * * @return A reference to this, so multiple invocations can be chained together. */ public HttpClient setMaxPoolSize(int maxConnections) { pool.setMaxPoolSize(maxConnections); return this; }