On Thu, 2012-06-28 at 17:45 +0200, Joan Balaguero wrote:
> Hello,
>
>
>
> Im trying to develop an AsyncHttpService class equivalent to my HttpService
> class, which uses the PoolingClientConnectionManager. After working with
> it, I have some doubts:
>
>
>
> 1. When I create the schemeRegistry:
>
> SchemeRegistry schemeRegistry = new SchemeRegistry();
>
> schemeRegistry.register(new Scheme("http", 80,
> PlainSocketFactory.getSocketFactory()));
>
> schemeRegistry.register(new Scheme("https", 443,
> SSLSocketFactory.getSocketFactory()));
>
>
>
> And now:
>
> AsyncSchemeRegistry asyncSchemeRegistry = new AsyncSchemeRegistry();
>
> asyncSchemeRegistry.register(new AsyncScheme("http", 80, ?));
>
> asyncSchemeRegistry.register(new AsyncScheme("https", 443, ?));
>
>
>
> I dont understand what a LayeringStrategy is, and how I can pass it to the
> AsyncScheme constructor.
>
>
You can pass an instance of SSLLayeringStrategy in case you need to
customize the SSL context or the way SSL is 'layered' over plain TCP/IP
>
>
>
> 2. How can I set the ConnectionPoolTimeout ?
>
HttpAsyncClient presently does not support a separate timeout for
connection lease requests. It uses connect timeout value when obtaining
a connection from the pool.
>
>
> 3. With HttpClient, to set connection and response timeout, cookies,
I
> use HttpParams. Whats the recommended way in Aysnc? HttpParams?
> IOReactor?
>
Exactly the same.
>
> With HttpClient:
>
> HttpConnectionParams.setConnectionTimeout(this.objHttpParams,
> connectionTimeout);
>
> HttpConnectionParams.setSoTimeout(this.objHttpParams, responseTimeout);
>
> HttpClientParams.setCookiePolicy(this.objHttpParams,
> CookiePolicy.BEST_MATCH);
>
>
>
> With Async?
>
Same.
> this.ioReactorConfig.setConnectTimeout(connectionTimeout);
>
> this.ioReactorConfig.setSoTimeout(responseTimeout);
>
> And cookies?
>
>
There is no need to meddle with the I/O reactor and its configuration.
With a few exceptions HttpAsyncClient can be configured using HttpParams
exactly the same way as HttpClient.
>
>
>
> 4. Do stale check and expect-continue and RetryHandler exist in
> AsynHttp?
>
>
The stale connection check is not applicable to HttpAsyncClient. There's
no need for stale connection check with NIO. The 'expect-continue' is
fully supported. Automatic retries are presently not implemented.
>
> 5. To shutdown the pool, should I use
> PoolingClientAsyncConnectionManager.shutdown() or
> ConnectingIOReactor.shutdown()?
>
>
ClientAsyncConnectionManager#shutdown()
Oleg
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]