public HttpClientGenerator setPoolSize(int poolSize) { connectionManager.setMaxTotal(poolSize); return this; }
public void open(HttpRoute route, HttpContext context, HttpParams params) throws IOException { assertAttached(); poolEntry.open(route, context, params); }
public void layerProtocol(HttpContext context, HttpParams params) throws IOException { assertAttached(); poolEntry.layerProtocol(context, params); }
private HttpClientManager() { manager = new PoolingHttpClientConnectionManager(); manager.setDefaultMaxPerRoute( CONNECTIONS_PER_ROUTE ); manager.setMaxTotal( TOTAL_CONNECTIONS ); }
public Builder proxy(HttpHost proxy, AuthenticationStrategy proxyAuthenticationStrategy) { this.httpRoutePlanner = new DefaultProxyRoutePlanner(proxy); this.proxyAuthenticationStrategy = proxyAuthenticationStrategy; return this; }
@Override public void run() { try { while (!shutdown) { synchronized (this) { wait(HTTPCLIENTCONNECTIONMANAGER_CLOSEWAITTIME_MS); for (PoolingHttpClientConnectionManager connectionManager : connectionManagers) { connectionManager.closeExpiredConnections(); connectionManager.closeIdleConnections(HTTPCLIENTCONNECTIONMANAGER_CLOSEIDLETIME_S, TimeUnit.SECONDS); } } } } catch (InterruptedException ex) { shutdown(); } }
@Override public void closeIdleConnections(long idleTimeout, TimeUnit unit) { connectionManager.closeIdleConnections(idleTimeout, unit); } }
public void close() throws IOException { if (poolEntry != null) poolEntry.shutdownEntry(); OperatedClientConnection conn = getWrappedConnection(); if (conn != null) { conn.close(); } }
public void tunnelTarget(boolean secure, HttpParams params) throws IOException { assertAttached(); poolEntry.tunnelTarget(secure, params); }
public void tunnelProxy(HttpHost next, boolean secure, HttpParams params) throws IOException { assertAttached(); poolEntry.tunnelProxy(next, secure, params); }
public Object getState() { assertAttached(); return poolEntry.getState(); }
public void setState(final Object state) { assertAttached(); poolEntry.setState(state); }
public ManagedClientConnection getConnection( long timeout, TimeUnit tunit) { return SingleClientConnManager.this.getConnection( route, state); }
/** * Creates a new connection adapter. * * @param entry the pool entry for the connection being wrapped * @param route the planned route for this connection */ protected ConnAdapter(PoolEntry entry, HttpRoute route) { super(SingleClientConnManager.this, entry); markReusable(); entry.route = route; }
@Override protected ClientConnectionManager getManager() { // override needed only to make method visible in this package return super.getManager(); }
@Override protected void detach() { // override needed only to make method visible in this package super.detach(); } }
/** * Detaches this adapter from the wrapped connection. * This adapter becomes useless. */ @Override protected void detach() { super.detach(); poolEntry = null; }
@Override protected HttpMessageParser createResponseParser( final SessionInputBuffer buffer, final HttpResponseFactory responseFactory, final HttpParams params) { // override in derived class to specify a line parser return new DefaultResponseParser (buffer, null, responseFactory, params); }
public Builder proxy(HttpHost proxy, AuthenticationStrategy proxyAuthenticationStrategy) { this.httpRoutePlanner = new DefaultProxyRoutePlanner(proxy); this.proxyAuthenticationStrategy = proxyAuthenticationStrategy; return this; }
@Override public void run() { try { while (!shutdown) { synchronized (this) { wait(HTTPCLIENTCONNECTIONMANAGER_CLOSEWAITTIME_MS); for (PoolingHttpClientConnectionManager connectionManager : connectionManagers) { connectionManager.closeExpiredConnections(); connectionManager.closeIdleConnections(HTTPCLIENTCONNECTIONMANAGER_CLOSEIDLETIME_S, TimeUnit.SECONDS); } } } } catch (InterruptedException ex) { shutdown(); } }