On Mon, 2012-12-17 at 07:08 +0000, Alex wrote:
> Hi,
>
> I thinking to use PoolingClientConnectionManager to connect to EPP server.
> The costrains for this server are :
> 1) number of max parallel connections
> 2) number of max requests in single connection and after use new connect
>
> For this task PoolingClientConnectionManager :
>
> 1) perfect ! I can set the max number of parallel connection !
> 2) no help or support for this
>
> Can anyone help me or give me any hint to implement the second point ?
>
> Thank you very much
Custom connection re-use strategy and connection metrics are your
friends
---
DefaultHttpClient client = new DefaultHttpClient();
client.setReuseStrategy(new DefaultConnectionReuseStrategy() {
@Override
public boolean keepAlive(HttpResponse response, HttpContext context)
{
boolean result = super.keepAlive(response, context);
if (result) {
HttpConnection conn = (HttpConnection) context.getAttribute(
ExecutionContext.HTTP_CONNECTION);
HttpConnectionMetrics metrics = conn.getMetrics();
if (metrics.getRequestCount() > 0) {
return false;
}
}
return result;
}
});
---
Oleg
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]