You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Mike Boyers <mb...@yahoo.com> on 2012/11/09 13:55:35 UTC

ConnManagerParams.setTimeout

I think there is an issue with the current javadoc for ConnManagerParams.

When I first began using HttpComponents/Client v4.0, I would use

ConnManagerParams.setTimeout(timeout)

to
 configure the timeout on the connection manager.  In my case, I set 
this very low because when any pool is at its maximum configured size, I
 want to fail fast and not wait for a connection to free up from the 
pool.

In looking at the source code, this effectively called:

params.setLongParameter("http.conn-manager.timeout", timeout);


In upgrading to the current 4.2.2 version, ConnManagerParams is deprecated.  The javadoc (http://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/org/apache/http/conn/params/ConnManagerParams.html) says to use

HttpConnectionParams.setConnectionTimeout(params, timeout)

but in looking at the source code, it looks like this effectively does the following:

params.setIntParameter("http.connection.timeout", timeout)

And when I've tested this method, it seems like it has no effect on the connection manager timeout.  If I instead use

params.setParameter(ClientPNames.CONN_MANAGER_TIMEOUT, timeout)

it seems to work as I would expect.

Does this seem accurate?  If so, is params.setParameter(ClientPNames.CONN_MANAGER_TIMEOUT, timeout) the preferred technique for setting the connection manager timeout going forward?

Thanks,
Mike


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Re: ConnManagerParams.setTimeout

Posted by Jean-Marc Spaggiari <je...@spaggiari.org>.
I figured also that timeout is not working very well and had to
implement my own timeout (starting the get on a thread and killing it
after the timeout if required). So I'm very interesting by what you
found here.

JM

2012/11/9, Mike Boyers <mb...@yahoo.com>:
> I think there is an issue with the current javadoc for ConnManagerParams.
>
> When I first began using HttpComponents/Client v4.0, I would use
>
> ConnManagerParams.setTimeout(timeout)
>
> to
>  configure the timeout on the connection manager.  In my case, I set
> this very low because when any pool is at its maximum configured size, I
>  want to fail fast and not wait for a connection to free up from the
> pool.
>
> In looking at the source code, this effectively called:
>
> params.setLongParameter("http.conn-manager.timeout", timeout);
>
>
> In upgrading to the current 4.2.2 version, ConnManagerParams is deprecated.
> The javadoc
> (http://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/org/apache/http/conn/params/ConnManagerParams.html)
> says to use
>
> HttpConnectionParams.setConnectionTimeout(params, timeout)
>
> but in looking at the source code, it looks like this effectively does the
> following:
>
> params.setIntParameter("http.connection.timeout", timeout)
>
> And when I've tested this method, it seems like it has no effect on the
> connection manager timeout.  If I instead use
>
> params.setParameter(ClientPNames.CONN_MANAGER_TIMEOUT, timeout)
>
> it seems to work as I would expect.
>
> Does this seem accurate?  If so, is
> params.setParameter(ClientPNames.CONN_MANAGER_TIMEOUT, timeout) the
> preferred technique for setting the connection manager timeout going
> forward?
>
> Thanks,
> Mike
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Re: ConnManagerParams.setTimeout

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Fri, 2012-11-09 at 04:55 -0800, Mike Boyers wrote:
> I think there is an issue with the current javadoc for ConnManagerParams.
> 
> When I first began using HttpComponents/Client v4.0, I would use
> 
> ConnManagerParams.setTimeout(timeout)
> 
> to
>  configure the timeout on the connection manager.  In my case, I set 
> this very low because when any pool is at its maximum configured size, I
>  want to fail fast and not wait for a connection to free up from the 
> pool.
> 
> In looking at the source code, this effectively called:
> 
> params.setLongParameter("http.conn-manager.timeout", timeout);
> 
> 
> In upgrading to the current 4.2.2 version, ConnManagerParams is deprecated.  The javadoc (http://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/org/apache/http/conn/params/ConnManagerParams.html) says to use
> 
> HttpConnectionParams.setConnectionTimeout(params, timeout)
> 
> but in looking at the source code, it looks like this effectively does the following:
> 
> params.setIntParameter("http.connection.timeout", timeout)
> 
> And when I've tested this method, it seems like it has no effect on the connection manager timeout.  If I instead use
> 
> params.setParameter(ClientPNames.CONN_MANAGER_TIMEOUT, timeout)
> 
> it seems to work as I would expect.
> 
> Does this seem accurate?  If so, is params.setParameter(ClientPNames.CONN_MANAGER_TIMEOUT, timeout) the preferred technique for setting the connection manager timeout going forward?
> 
> Thanks,
> Mike
> 

Mike

HttpClient's configuration API is a mess. I am working on fairly major
changes in that area in the trunk (4.3 series). Everything HttpParams
related should be gone (deprecated) in the next feature release and
replaced by plain old java objects.

Oleg



---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org