You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2011/04/30 13:11:51 UTC

svn commit: r1098098 - in /httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http: client/params/ impl/client/

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

Modified:
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/params/ClientPNames.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/params/ClientParamBean.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/params/HttpClientParams.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultHttpClient.java
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultRequestDirector.java

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

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/params/ClientParamBean.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/params/ClientParamBean.java?rev=1098098&r1=1098097&r2=1098098&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/params/ClientParamBean.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/params/ClientParamBean.java Sat Apr 30 11:11:51 2011
@@ -96,4 +96,11 @@ public class ClientParamBean extends Htt
         params.setParameter(ClientPNames.DEFAULT_HOST, host);
     }
 
+    /**
+     * @since 4.2
+     */
+    public void setConnectionManagerTimeout(final long timeout) {
+        params.setLongParameter(ClientPNames.CONN_MANAGER_TIMEOUT, timeout);
+    }
+
 }

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);
+    }
+
 }

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultHttpClient.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultHttpClient.java?rev=1098098&r1=1098097&r2=1098098&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultHttpClient.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultHttpClient.java Sat Apr 30 11:11:51 2011
@@ -109,6 +109,7 @@ import org.apache.http.util.VersionInfo;
  *  <li>{@link org.apache.http.client.params.ClientPNames#DEFAULT_HOST}</li>
  *  <li>{@link org.apache.http.client.params.ClientPNames#DEFAULT_HEADERS}</li>
  *  <li>{@link org.apache.http.client.params.ClientPNames#CONNECTION_MANAGER_FACTORY_CLASS_NAME}</li>
+ *  <li>{@link org.apache.http.client.params.ClientPNames#CONN_MANAGER_TIMEOUT}</li>
  * </ul>
  *
  * @since 4.0

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultRequestDirector.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultRequestDirector.java?rev=1098098&r1=1098097&r2=1098098&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultRequestDirector.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/DefaultRequestDirector.java Sat Apr 30 11:11:51 2011
@@ -126,6 +126,7 @@ import org.apache.http.util.EntityUtils;
  *  <li>{@link org.apache.http.client.params.ClientPNames#VIRTUAL_HOST}</li>
  *  <li>{@link org.apache.http.client.params.ClientPNames#DEFAULT_HOST}</li>
  *  <li>{@link org.apache.http.client.params.ClientPNames#DEFAULT_HEADERS}</li>
+ *  <li>{@link org.apache.http.client.params.ClientPNames#CONN_MANAGER_TIMEOUT}</li>
  * </ul>
  *
  * @since 4.0
@@ -360,8 +361,6 @@ public class DefaultRequestDirector impl
 
         RoutedRequest roureq = new RoutedRequest(origWrapper, origRoute);
 
-        long timeout = HttpConnectionParams.getConnectionTimeout(params);
-
         boolean reuse = false;
         boolean done = false;
         try {
@@ -387,6 +386,7 @@ public class DefaultRequestDirector impl
                         ((AbortableHttpRequest) orig).setConnectionRequest(connRequest);
                     }
 
+                    long timeout = HttpClientParams.getConnectionManagerTimeout(params);
                     try {
                         managedConn = connRequest.getConnection(timeout, TimeUnit.MILLISECONDS);
                     } catch(InterruptedException interrupted) {



Re: svn commit: r1098098

Posted by sebb <se...@gmail.com>.
On 5 May 2011 16:07, sebb <se...@gmail.com> wrote:
> On 5 May 2011 16:04, Oleg Kalnichevski <ol...@apache.org> wrote:
>> On Thu, 2011-05-05 at 15:53 +0100, sebb wrote:
>>> On 5 May 2011 15:43, Oleg Kalnichevski <ol...@apache.org> wrote:
>>> > On Thu, 2011-05-05 at 01:33 +0100, sebb wrote:
>>> >> On 30 April 2011 12:11,  <ol...@apache.org> wrote:
>>> >
>>> > ...
>>> >
>>> >> +    /**
>>> >> +     * 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.
>>> >>
>>> >
>>> > This goes back to the jolly ol' days of HttpClient 2.x and the very
>>> > first versions of MultiThreadedHttpConnectionManager, when features
>>> > mattered most and developers were much less concerned with the clarity
>>> > and consistency of the API.
>>> >
>>> >
>>> >> Not sure I understand why the ConnMgr Timeout should default to the
>>> >> Connection Timeout.
>>> >
>>> > I personally do not see a lot of convincing reasons to differentiate
>>> > these two cases. Ultimately both serve to ensure that I/O threads do not
>>> > block indefinitely waiting for a connection. 4.1 version was released
>>> > with the former deprecated in favor of the latter. If we want to
>>> > re-introduce the connection manager timeout as a separate parameter, at
>>> > the very least we should make an effort to preserve behavioral
>>> > compatibility with 4.1.
>>> >
>>> >
>>> >> [Also one is long, the other int.]
>>> >>
>>> >
>>> > Historical. See above.
>>> >
>>> >> If the ConnMgr timeout is not set, I would expect it to default to 0
>>> >> (i.e. infinite)
>>> >>
>>> >
>>> > Again, this is done for the sake of compatibility with 4.1. If you think
>>> > this makes things even more confusing, I am fine with changing the
>>> > behavior of the pooling connection manager. In this case, though, we
>>> > will end up breaking applications that rely on the connect timeout to
>>> > ensure that connection manager operations do not block indefinitely. At
>>> > the very least this will need to be documented and explained.
>>>
>>> OK, I see.
>>>
>>> In that case I'll document the current behaviour of
>>> getConnectionManagerTimeout().
>>>
>>
>> What happened to the initial idea of moving this logic to the
>> DefaultRequestDirector?
>
> It got lost in the ether - I'll do that (with Javadoc) instead.

On second thoughts, I think it would be better to just document the
behaviour of the getConnectionManagerTimeout() method.
That way, any other RequestDirector implementations can make use of
the same default logic.

The situation for 4.1.x is a bit different, as there is no
getConnectionManagerTimeout() method.

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

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


Re: svn commit: r1098098

Posted by sebb <se...@gmail.com>.
On 5 May 2011 16:04, Oleg Kalnichevski <ol...@apache.org> wrote:
> On Thu, 2011-05-05 at 15:53 +0100, sebb wrote:
>> On 5 May 2011 15:43, Oleg Kalnichevski <ol...@apache.org> wrote:
>> > On Thu, 2011-05-05 at 01:33 +0100, sebb wrote:
>> >> On 30 April 2011 12:11,  <ol...@apache.org> wrote:
>> >
>> > ...
>> >
>> >> +    /**
>> >> +     * 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.
>> >>
>> >
>> > This goes back to the jolly ol' days of HttpClient 2.x and the very
>> > first versions of MultiThreadedHttpConnectionManager, when features
>> > mattered most and developers were much less concerned with the clarity
>> > and consistency of the API.
>> >
>> >
>> >> Not sure I understand why the ConnMgr Timeout should default to the
>> >> Connection Timeout.
>> >
>> > I personally do not see a lot of convincing reasons to differentiate
>> > these two cases. Ultimately both serve to ensure that I/O threads do not
>> > block indefinitely waiting for a connection. 4.1 version was released
>> > with the former deprecated in favor of the latter. If we want to
>> > re-introduce the connection manager timeout as a separate parameter, at
>> > the very least we should make an effort to preserve behavioral
>> > compatibility with 4.1.
>> >
>> >
>> >> [Also one is long, the other int.]
>> >>
>> >
>> > Historical. See above.
>> >
>> >> If the ConnMgr timeout is not set, I would expect it to default to 0
>> >> (i.e. infinite)
>> >>
>> >
>> > Again, this is done for the sake of compatibility with 4.1. If you think
>> > this makes things even more confusing, I am fine with changing the
>> > behavior of the pooling connection manager. In this case, though, we
>> > will end up breaking applications that rely on the connect timeout to
>> > ensure that connection manager operations do not block indefinitely. At
>> > the very least this will need to be documented and explained.
>>
>> OK, I see.
>>
>> In that case I'll document the current behaviour of
>> getConnectionManagerTimeout().
>>
>
> What happened to the initial idea of moving this logic to the
> DefaultRequestDirector?

It got lost in the ether - I'll do that (with Javadoc) instead.

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

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


Re: svn commit: r1098098

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Thu, 2011-05-05 at 15:53 +0100, sebb wrote:
> On 5 May 2011 15:43, Oleg Kalnichevski <ol...@apache.org> wrote:
> > On Thu, 2011-05-05 at 01:33 +0100, sebb wrote:
> >> On 30 April 2011 12:11,  <ol...@apache.org> wrote:
> >
> > ...
> >
> >> +    /**
> >> +     * 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.
> >>
> >
> > This goes back to the jolly ol' days of HttpClient 2.x and the very
> > first versions of MultiThreadedHttpConnectionManager, when features
> > mattered most and developers were much less concerned with the clarity
> > and consistency of the API.
> >
> >
> >> Not sure I understand why the ConnMgr Timeout should default to the
> >> Connection Timeout.
> >
> > I personally do not see a lot of convincing reasons to differentiate
> > these two cases. Ultimately both serve to ensure that I/O threads do not
> > block indefinitely waiting for a connection. 4.1 version was released
> > with the former deprecated in favor of the latter. If we want to
> > re-introduce the connection manager timeout as a separate parameter, at
> > the very least we should make an effort to preserve behavioral
> > compatibility with 4.1.
> >
> >
> >> [Also one is long, the other int.]
> >>
> >
> > Historical. See above.
> >
> >> If the ConnMgr timeout is not set, I would expect it to default to 0
> >> (i.e. infinite)
> >>
> >
> > Again, this is done for the sake of compatibility with 4.1. If you think
> > this makes things even more confusing, I am fine with changing the
> > behavior of the pooling connection manager. In this case, though, we
> > will end up breaking applications that rely on the connect timeout to
> > ensure that connection manager operations do not block indefinitely. At
> > the very least this will need to be documented and explained.
> 
> OK, I see.
> 
> In that case I'll document the current behaviour of
> getConnectionManagerTimeout().
> 

What happened to the initial idea of moving this logic to the
DefaultRequestDirector?

cheers

Oleg



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


Re: svn commit: r1098098

Posted by sebb <se...@gmail.com>.
On 5 May 2011 15:43, Oleg Kalnichevski <ol...@apache.org> wrote:
> On Thu, 2011-05-05 at 01:33 +0100, sebb wrote:
>> On 30 April 2011 12:11,  <ol...@apache.org> wrote:
>
> ...
>
>> +    /**
>> +     * 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.
>>
>
> This goes back to the jolly ol' days of HttpClient 2.x and the very
> first versions of MultiThreadedHttpConnectionManager, when features
> mattered most and developers were much less concerned with the clarity
> and consistency of the API.
>
>
>> Not sure I understand why the ConnMgr Timeout should default to the
>> Connection Timeout.
>
> I personally do not see a lot of convincing reasons to differentiate
> these two cases. Ultimately both serve to ensure that I/O threads do not
> block indefinitely waiting for a connection. 4.1 version was released
> with the former deprecated in favor of the latter. If we want to
> re-introduce the connection manager timeout as a separate parameter, at
> the very least we should make an effort to preserve behavioral
> compatibility with 4.1.
>
>
>> [Also one is long, the other int.]
>>
>
> Historical. See above.
>
>> If the ConnMgr timeout is not set, I would expect it to default to 0
>> (i.e. infinite)
>>
>
> Again, this is done for the sake of compatibility with 4.1. If you think
> this makes things even more confusing, I am fine with changing the
> behavior of the pooling connection manager. In this case, though, we
> will end up breaking applications that rely on the connect timeout to
> ensure that connection manager operations do not block indefinitely. At
> the very least this will need to be documented and explained.

OK, I see.

In that case I'll document the current behaviour of
getConnectionManagerTimeout().

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

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


Re: svn commit: r1098098

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Thu, 2011-05-05 at 01:33 +0100, sebb wrote:
> On 30 April 2011 12:11,  <ol...@apache.org> wrote:

...

> +    /**
> +     * 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.
> 

This goes back to the jolly ol' days of HttpClient 2.x and the very
first versions of MultiThreadedHttpConnectionManager, when features
mattered most and developers were much less concerned with the clarity
and consistency of the API.


> Not sure I understand why the ConnMgr Timeout should default to the
> Connection Timeout.

I personally do not see a lot of convincing reasons to differentiate
these two cases. Ultimately both serve to ensure that I/O threads do not
block indefinitely waiting for a connection. 4.1 version was released
with the former deprecated in favor of the latter. If we want to
re-introduce the connection manager timeout as a separate parameter, at
the very least we should make an effort to preserve behavioral
compatibility with 4.1.  


> [Also one is long, the other int.]
> 

Historical. See above.

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

Again, this is done for the sake of compatibility with 4.1. If you think
this makes things even more confusing, I am fine with changing the
behavior of the pooling connection manager. In this case, though, we
will end up breaking applications that rely on the connect timeout to
ensure that connection manager operations do not block indefinitely. At
the very least this will need to be documented and explained.

Oleg



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


Re: svn commit: r1098098 - in /httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http: client/params/ impl/client/

Posted by sebb <se...@gmail.com>.
On 30 April 2011 12:11,  <ol...@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