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 bensonthomas <be...@sbcglobal.net> on 2008/12/30 20:39:34 UTC
Timeout input parameter not used in getConnectionWithTimeout method
I got the source code to check the functionality for timeout and I see that
this is not used in the code. What is the impact of this NOT being used in
the code? Help appreciated. Thanks
/**
* This method always returns the same connection object. If the
connection is already
* open, it will be closed and the new host configuration will be
applied.
*
* @param hostConfiguration The host configuration specifying the
connection
* details.
* @param timeout this parameter has no effect. The connection is always
returned
* immediately.
* @since 3.0
*/
public HttpConnection getConnectionWithTimeout(
HostConfiguration hostConfiguration, long timeout) {
if (httpConnection == null) {
httpConnection = new HttpConnection(hostConfiguration);
httpConnection.setHttpConnectionManager(this);
httpConnection.getParams().setDefaults(this.params);
} else {
// make sure the host and proxy are correct for this connection
// close it and set the values if they are not
if (!hostConfiguration.hostEquals(httpConnection)
|| !hostConfiguration.proxyEquals(httpConnection)) {
if (httpConnection.isOpen()) {
httpConnection.close();
}
httpConnection.setHost(hostConfiguration.getHost());
httpConnection.setPort(hostConfiguration.getPort());
httpConnection.setProtocol(hostConfiguration.getProtocol());
httpConnection.setLocalAddress(hostConfiguration.getLocalAddress());
httpConnection.setProxyHost(hostConfiguration.getProxyHost());
httpConnection.setProxyPort(hostConfiguration.getProxyPort());
} else {
finishLastResponse(httpConnection);
}
}
// remove the connection from the timeout handler
idleStartTime = Long.MAX_VALUE;
if (inUse) LOG.warn(MISUSE_MESSAGE);
inUse = true;
return httpConnection;
}
--
View this message in context: http://www.nabble.com/Timeout-input-parameter-not-used-in-getConnectionWithTimeout-method-tp21222106p21222106.html
Sent from the HttpClient-User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org
Re: Timeout input parameter not used in getConnectionWithTimeout
method
Posted by Oleg Kalnichevski <ol...@apache.org>.
On Tue, 2008-12-30 at 11:39 -0800, bensonthomas wrote:
> I got the source code to check the functionality for timeout and I see that
> this is not used in the code.
This is not the case.
Oleg
> What is the impact of this NOT being used in
> the code? Help appreciated. Thanks
>
>
>
> /**
> * This method always returns the same connection object. If the
> connection is already
> * open, it will be closed and the new host configuration will be
> applied.
> *
> * @param hostConfiguration The host configuration specifying the
> connection
> * details.
> * @param timeout this parameter has no effect. The connection is always
> returned
> * immediately.
> * @since 3.0
> */
> public HttpConnection getConnectionWithTimeout(
> HostConfiguration hostConfiguration, long timeout) {
>
> if (httpConnection == null) {
> httpConnection = new HttpConnection(hostConfiguration);
> httpConnection.setHttpConnectionManager(this);
> httpConnection.getParams().setDefaults(this.params);
> } else {
>
> // make sure the host and proxy are correct for this connection
> // close it and set the values if they are not
> if (!hostConfiguration.hostEquals(httpConnection)
> || !hostConfiguration.proxyEquals(httpConnection)) {
>
> if (httpConnection.isOpen()) {
> httpConnection.close();
> }
>
> httpConnection.setHost(hostConfiguration.getHost());
> httpConnection.setPort(hostConfiguration.getPort());
> httpConnection.setProtocol(hostConfiguration.getProtocol());
>
> httpConnection.setLocalAddress(hostConfiguration.getLocalAddress());
>
>
> httpConnection.setProxyHost(hostConfiguration.getProxyHost());
>
> httpConnection.setProxyPort(hostConfiguration.getProxyPort());
> } else {
> finishLastResponse(httpConnection);
> }
> }
>
> // remove the connection from the timeout handler
> idleStartTime = Long.MAX_VALUE;
>
> if (inUse) LOG.warn(MISUSE_MESSAGE);
> inUse = true;
>
> return httpConnection;
> }
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org