List of usage examples for org.apache.http.impl.nio.client DefaultAsyncRequestDirector DefaultAsyncRequestDirector
public DefaultAsyncRequestDirector(final Log log, final HttpAsyncRequestProducer requestProducer, final HttpAsyncResponseConsumer<T> responseConsumer, final HttpContext localContext, final ResultCallback<T> callback, final ClientAsyncConnectionManager connmgr, final HttpProcessor httppocessor, final HttpRoutePlanner routePlanner, final ConnectionReuseStrategy reuseStrategy, final ConnectionKeepAliveStrategy keepaliveStrategy, final RedirectStrategy redirectStrategy, final AuthenticationStrategy targetAuthStrategy, final AuthenticationStrategy proxyAuthStrategy, final UserTokenHandler userTokenHandler, final HttpParams clientParams)
From source file:org.apache.http.impl.nio.client.AbstractHttpAsyncClient.java
@Override public <T> Future<T> execute(final HttpAsyncRequestProducer requestProducer, final HttpAsyncResponseConsumer<T> responseConsumer, final HttpContext context, final FutureCallback<T> callback) { if (this.terminated) { throw new IllegalStateException("Client has been shut down"); }// w w w .j a v a 2 s .c o m final BasicFuture<T> future = new BasicFuture<T>(callback); final ResultCallback<T> resultCallback = new DefaultResultCallback<T>(future, this.queue); DefaultAsyncRequestDirector<T> httpexchange; synchronized (this) { final HttpContext defaultContext = createHttpContext(); HttpContext execContext; if (context == null) { execContext = defaultContext; } else { execContext = new DefaultedHttpContext(context, defaultContext); } httpexchange = new DefaultAsyncRequestDirector<T>(this.log, requestProducer, responseConsumer, execContext, resultCallback, this.connmgr, getProtocolProcessor(), getRoutePlanner(), getConnectionReuseStrategy(), getConnectionKeepAliveStrategy(), getRedirectStrategy(), getTargetAuthenticationStrategy(), getProxyAuthenticationStrategy(), getUserTokenHandler(), getParams()); } this.queue.add(httpexchange); httpexchange.start(); return future; }