hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: Timeout input parameter not used in getConnectionWithTimeout method
Date Mon, 05 Jan 2009 09:44:41 GMT
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


Mime
View raw message