On 13 Nov 2013, at 4:43 PM, Oleg Kalnichevski <[email protected]> wrote:
> On Wed, 2013-11-13 at 14:35 +0100, Sebastiano Vigna wrote:
>> Question: when a connection opened with DefaultConnectionReuseStrategy will
>> be actually closed? When the same client is used with a different host? Or
>> is there some explicit operation that must be done to close the connection?
>>
>
> I am not sure I understand the question. Do you mean when a connection
> kept alive in the pool gets closed when expired?
Sorry.
We use the following client:
httpClient = HttpClients.custom()
.setSslcontext( TRUST_SELF_SIGNED_SSL_CONTEXT )
.setConnectionManager( connManager )
.setConnectionReuseStrategy(
DefaultConnectionReuseStrategy.INSTANCE )
.build();
Now, after we do a number of consecutive fetches form the same host, we know
that it won't happen for several seconds, or even minutes. We don't want the
client to keep the connection open after we completed our fetch cycle. We
download in parallel from hundreds of thousands of hosts at several thousand
pages per second, so we cannot leave open connection around or we risk to
exaust the ports.
How can we be sure that the TCP connection with a host is shut down
immediately, after we finish our batch of consecutive fetches?
Ciao,
seba
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]