List of usage examples for org.apache.http.impl.nio.client DefaultAsyncRequestDirector start
public synchronized void start()
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"); }//from w w w . ja v a 2s.c om 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; }