hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: svn commit: r1098098 - in /httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http: client/params/ impl/client/
Date Thu, 05 May 2011 00:33:19 GMT
On 30 April 2011 12:11,  <olegk@apache.org> wrote:
> Author: olegk
> Date: Sat Apr 30 11:11:51 2011
> New Revision: 1098098
>
> URL: http://svn.apache.org/viewvc?rev=1098098&view=rev
> Log:
> Re-introduced timeout parameter for connection manager operations

[snip].

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/params/ClientPNames.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/params/ClientPNames.java?rev=1098098&r1=1098097&r2=1098098&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/params/ClientPNames.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/params/ClientPNames.java
Sat Apr 30 11:11:51 2011
@@ -126,5 +126,16 @@ public interface ClientPNames {
     */
    public static final String DEFAULT_HOST = "http.default-host";

+    /**
+     * Defines the timeout in milliseconds used when retrieving an instance of
+     * {@link org.apache.http.conn.ManagedClientConnection} from the
+     * {@link org.apache.http.conn.ClientConnectionManager}.
+     * <p>
+     * This parameter expects a value of type {@link Long}.

Why is this Long?

The related parameter CoreConnectionPNames.CONNECTION_TIMEOUT is an Integer.

+     * <p>
+     * @since 4.2
+     */
+    public static final String CONN_MANAGER_TIMEOUT =
"http.conn-manager.timeout";
+
 }

[snip]

> Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/params/HttpClientParams.java
> URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/params/HttpClientParams.java?rev=1098098&r1=1098097&r2=1098098&view=diff
> ==============================================================================
> --- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/params/HttpClientParams.java
(original)
> +++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/params/HttpClientParams.java
Sat Apr 30 11:11:51 2011
> @@ -28,6 +28,7 @@ package org.apache.http.client.params;
>
>  import org.apache.http.annotation.Immutable;
>
> +import org.apache.http.params.HttpConnectionParams;
>  import org.apache.http.params.HttpParams;
>
>  /**
> @@ -93,4 +94,28 @@ public class HttpClientParams {
>         params.setParameter(ClientPNames.COOKIE_POLICY, cookiePolicy);
>     }
>
> +    /**
> +     * @since 4.2
> +     */
> +    public static void setConnectionManagerTimeout(final HttpParams params, long timeout)
{
> +        if (params == null) {
> +            throw new IllegalArgumentException("HTTP parameters may not be null");
> +        }
> +        params.setLongParameter(ClientPNames.CONN_MANAGER_TIMEOUT, timeout);
> +    }
> +
> +    /**
> +     * @since 4.2
> +     */
> +    public static long getConnectionManagerTimeout(final HttpParams params) {
> +        if (params == null) {
> +            throw new IllegalArgumentException("HTTP parameters may not be null");
> +        }
> +        Long timeout = (Long) params.getParameter(ClientPNames.CONN_MANAGER_TIMEOUT);
> +        if (timeout != null) {
> +            return timeout.longValue();
> +        }
> +        return HttpConnectionParams.getConnectionTimeout(params);
> +    }

Not sure I understand why the ConnMgr Timeout should default to the
Connection Timeout.
[Also one is long, the other int.]

If the ConnMgr timeout is not set, I would expect it to default to 0
(i.e. infinite)

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


Mime
View raw message