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 2008/04/14 16:17:06 UTC

svn commit: r647810 - in /httpcomponents/httpclient/trunk: ./ module-client/src/main/java/org/apache/http/conn/params/ module-client/src/main/java/org/apache/http/impl/conn/tsccm/ module-client/src/test/java/org/apache/http/conn/params/ module-client/s...

Author: olegk
Date: Mon Apr 14 07:17:01 2008
New Revision: 647810

URL: http://svn.apache.org/viewvc?rev=647810&view=rev
Log:
HTTPCLIENT-673: Revised max connections per route configuration

Added:
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/params/ConnPerRoute.java   (with props)
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/params/ConnPerRouteBean.java   (with props)
Removed:
    httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/conn/params/TestParams.java
Modified:
    httpcomponents/httpclient/trunk/RELEASE_NOTES.txt
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/params/ConnManagerPNames.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/params/ConnManagerParamBean.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/params/HttpConnectionManagerParams.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/ConnPoolByRoute.java
    httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/conn/params/TestAllConnParams.java
    httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/conn/TestTSCCMNoServer.java
    httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/conn/TestTSCCMWithServer.java
    httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/conn/tsccm/TestSpuriousWakeup.java

Modified: httpcomponents/httpclient/trunk/RELEASE_NOTES.txt
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/RELEASE_NOTES.txt?rev=647810&r1=647809&r2=647810&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/RELEASE_NOTES.txt (original)
+++ httpcomponents/httpclient/trunk/RELEASE_NOTES.txt Mon Apr 14 07:17:01 2008
@@ -1,6 +1,9 @@
 Changes since 4.0 Alpha 3
 -------------------
 
+* [HTTPCLIENT-673] Revised max connections per route configuration
+  Contributed by Oleg Kalnichevski <olegk at apache.org>
+
 * [HTTPCLIENT-753] Class Scheme and related classes moved to a separate package
   Contributed by Oleg Kalnichevski <olegk at apache.org>
 

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/params/ConnManagerPNames.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/params/ConnManagerPNames.java?rev=647810&r1=647809&r2=647810&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/params/ConnManagerPNames.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/params/ConnManagerPNames.java Mon Apr 14 07:17:01 2008
@@ -40,21 +40,15 @@
  */
 public interface ConnManagerPNames {
 
-
-
     /** 
-     * Defines the maximum number of connections to a host.
+     * Defines the maximum number of connections per route.
      * This limit is interpreted by client connection managers
      * and applies to individual manager instances.
      * <p>
-     * This parameter expects a value of type {@link java.util.Map}.
-     * The value should map instances of
-     * {@link org.apache.http.conn.routing.HttpRoute}
-     * to {@link Integer integers}.
-     * The default value is mapped to a special, private key.
+     * This parameter expects a value of type {@link ConnPerRouteBean}.
      * </p>
      */
-    public static final String MAX_HOST_CONNECTIONS = "http.connection-manager.max-per-host";
+    public static final String MAX_CONNECTIONS_PER_ROUTE = "http.conn-manager.max-per-route";
 
     /** 
      * Defines the maximum number of connections in total.
@@ -64,6 +58,6 @@
      * This parameter expects a value of type {@link Integer}.
      * </p>
      */
-    public static final String MAX_TOTAL_CONNECTIONS = "http.connection-manager.max-total";
+    public static final String MAX_TOTAL_CONNECTIONS = "http.conn-manager.max-total";
 
 }

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/params/ConnManagerParamBean.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/params/ConnManagerParamBean.java?rev=647810&r1=647809&r2=647810&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/params/ConnManagerParamBean.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/params/ConnManagerParamBean.java Mon Apr 14 07:17:01 2008
@@ -1,7 +1,7 @@
 /*
- * $HeadURL:$
- * $Revision:$
- * $Date:$
+ * $HeadURL$
+ * $Revision$
+ * $Date$
  *
  * ====================================================================
  * Licensed to the Apache Software Foundation (ASF) under one
@@ -40,12 +40,12 @@
         super(params);
     }
 
-    public void setMaxHostConnections (final int maxConnections) {
-        params.setIntParameter(ConnManagerPNames.MAX_HOST_CONNECTIONS, maxConnections);
-    }
-
     public void setMaxTotalConnections (final int maxConnections) {
         params.setIntParameter(ConnManagerPNames.MAX_TOTAL_CONNECTIONS, maxConnections);
     }
     
+    public void setConnectionsPerRoute(final ConnPerRouteBean connPerRoute) {
+        params.setParameter(ConnManagerPNames.MAX_CONNECTIONS_PER_ROUTE, connPerRoute);
+    }
+
 }

Added: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/params/ConnPerRoute.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/params/ConnPerRoute.java?rev=647810&view=auto
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/params/ConnPerRoute.java (added)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/params/ConnPerRoute.java Mon Apr 14 07:17:01 2008
@@ -0,0 +1,51 @@
+/*
+ * $HeadURL:$
+ * $Revision:$
+ * $Date:$
+ *
+ * ====================================================================
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+package org.apache.http.conn.params;
+
+import org.apache.http.conn.routing.HttpRoute;
+
+/**
+ * This interface interface is intended to lookup maximum number of connections 
+ * allowed for for a given route. This class can be used by pooling 
+ * {@link org.apache.http.conn.ClientConnectionManager connection managers} for 
+ * a fine-grained control of connections on a per route basis. 
+ * 
+ * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
+ * 
+ * @version $Revision:$
+ * 
+ * @since 4.0
+ */
+public interface ConnPerRoute {
+
+    int getMaxForRoute(HttpRoute route);
+    
+}

Propchange: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/params/ConnPerRoute.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/params/ConnPerRoute.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/params/ConnPerRoute.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/params/ConnPerRouteBean.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/params/ConnPerRouteBean.java?rev=647810&view=auto
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/params/ConnPerRouteBean.java (added)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/params/ConnPerRouteBean.java Mon Apr 14 07:17:01 2008
@@ -0,0 +1,114 @@
+/*
+ * $HeadURL:$
+ * $Revision:$
+ * $Date:$
+ *
+ * ====================================================================
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+package org.apache.http.conn.params;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.http.conn.routing.HttpRoute;
+
+/**
+ * This class maintains a map of HTTP routes to maximum number of connections allowed 
+ * for those routes. This class can be used by pooling 
+ * {@link org.apache.http.conn.ClientConnectionManager connection managers} for 
+ * a fine-grained control of connections on a per route basis. 
+ * 
+ * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
+ * 
+ * @version $Revision:$
+ * 
+ * @since 4.0
+ */
+public final class ConnPerRouteBean implements ConnPerRoute {
+
+    /** The default maximum number of connections allowed per host */
+    public static final int DEFAULT_MAX_CONNECTIONS_PER_ROUTE = 2;   // Per RFC 2616 sec 8.1.4
+    
+    private Map<HttpRoute, Integer> maxPerHostMap;
+    
+    private int defaultMax;
+    
+    public ConnPerRouteBean(int defaultMax) {
+        super();
+        this.maxPerHostMap = new HashMap<HttpRoute, Integer>();
+        setDefaultMaxPerRoute(defaultMax);
+    }
+    
+    public ConnPerRouteBean() {
+        this(DEFAULT_MAX_CONNECTIONS_PER_ROUTE);
+    }
+    
+    public int getDefaultMax() {
+        return this.defaultMax;
+    }
+
+    public void setDefaultMaxPerRoute(int max) {
+        if (max < 1) {
+            throw new IllegalArgumentException
+                ("The maximum must be greater than 0.");
+        }
+        this.defaultMax = max;
+    }
+
+    public void setMaxForRoute(final HttpRoute route, int max) {
+        if (route == null) {
+            throw new IllegalArgumentException
+                ("HTTP route may not be null.");
+        }
+        if (max < 1) {
+            throw new IllegalArgumentException
+                ("The maximum must be greater than 0.");
+        }
+        this.maxPerHostMap.put(route, Integer.valueOf(max));
+    }
+
+    public int getMaxForRoute(final HttpRoute route) {
+        if (route == null) {
+            throw new IllegalArgumentException
+                ("HTTP route may not be null.");
+        }
+        Integer max = this.maxPerHostMap.get(route);
+        if (max != null) {
+            return max.intValue();
+        } else {
+            return this.defaultMax;
+        }
+    }
+    
+    public void setMaxForRoutes(final Map<HttpRoute, Integer> map) {
+        if (map == null) {
+            return;
+        }
+        this.maxPerHostMap.clear();
+        this.maxPerHostMap.putAll(map);
+    }
+    
+}

Propchange: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/params/ConnPerRouteBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/params/ConnPerRouteBean.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/params/ConnPerRouteBean.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/params/HttpConnectionManagerParams.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/params/HttpConnectionManagerParams.java?rev=647810&r1=647809&r2=647810&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/params/HttpConnectionManagerParams.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/params/HttpConnectionManagerParams.java Mon Apr 14 07:17:01 2008
@@ -30,9 +30,6 @@
 
 package org.apache.http.conn.params;
 
-import java.util.HashMap;
-import java.util.Map;
-
 import org.apache.http.conn.routing.HttpRoute;
 import org.apache.http.params.HttpParams;
 
@@ -50,102 +47,38 @@
  *
  * @see ConnManagerPNames
  */
-public final class HttpConnectionManagerParams {
-
-    /** The default maximum number of connections allowed per host */
-    public static final int DEFAULT_MAX_HOST_CONNECTIONS = 2;   // Per RFC 2616 sec 8.1.4
+public final class HttpConnectionManagerParams implements ConnManagerPNames {
 
     /** The default maximum number of connections allowed overall */
     public static final int DEFAULT_MAX_TOTAL_CONNECTIONS = 20;
 
-    /** A key to represent the default for route-specific settings. */
-    private static final String ROUTE_DEFAULT = "*Route*Default*";
-
-
-
+    /** The default maximum number of connections allowed per host */
+    private static ConnPerRoute DEFAULT_CONN_PER_ROUTE = new ConnPerRoute() {
+        
+        public int getMaxForRoute(HttpRoute route) {
+            return ConnPerRouteBean.DEFAULT_MAX_CONNECTIONS_PER_ROUTE;
+        }
+        
+    };
+    
     /**
-     * Sets the default maximum number of connections allowed for routes.
+     * Sets maximum number of connections allowed per route lookup interface.
      *
      * @param max The default maximum.
      * 
      * @see ConnManagerPNames#MAX_HOST_CONNECTIONS
      */
-    public static void setDefaultMaxConnectionsPerHost(final HttpParams params,
-                                                       final int max) {
-        setMaxPerHost(params, ROUTE_DEFAULT, max);
-    }
-
-    /**
-     * Sets the maximum number of connections to be used for a given route.
-     * 
-     * @param route     the route to set the maximum for
-     * @param max       the maximum number of connections,
-     *                  must be greater than 0
-     * 
-     * @see ConnManagerPNames#MAX_HOST_CONNECTIONS
-     */
-    public static void setMaxConnectionsPerHost(final HttpParams params,
-                                                final HttpRoute route,
-                                                final int max) {
-        if (route == null) {
-            throw new IllegalArgumentException
-                ("Route must not be null.");
-        }
-        setMaxPerHost(params, route, max);
-    }
-
-
-    /**
-     * Internal setter for a max-per-host value.
-     *
-     * @param params    the parameters in which to set a max-per-host value
-     * @param key       the key, either an {@link HttpRoute} or
-     *                  {@link #ROUTE_DEFAULT}
-     * @param max       the value to set for that key
-     */
-    private static void setMaxPerHost(HttpParams params,
-                                      Object key, int max) {
+    public static void setMaxConnectionsPerRoute(final HttpParams params,
+                                                final ConnPerRoute connPerRoute) {
         if (params == null) {
             throw new IllegalArgumentException
                 ("HTTP parameters must not be null.");
         }
-        if (max <= 0) {
-            throw new IllegalArgumentException
-                ("The maximum must be greater than 0.");
-        }
-        
-        Map<?,?> currentValues = (Map<?,?>) params.getParameter
-            (ConnManagerPNames.MAX_HOST_CONNECTIONS);
-        // param values are meant to be immutable so we'll make a copy
-        // to modify
-        Map<Object,Object> newValues = null;
-        if (currentValues == null) {
-            newValues = new HashMap<Object,Object>();
-        } else {
-            newValues = new HashMap<Object,Object>(currentValues);
-        }
-        newValues.put(key, Integer.valueOf(max));
-        params.setParameter(ConnManagerPNames.MAX_HOST_CONNECTIONS, newValues);
+        params.setParameter(MAX_CONNECTIONS_PER_ROUTE, connPerRoute);
     }
 
-    
     /**
-     * Gets the default maximum number of connections allowed for a given
-     * host config.
-     *
-     * @return The default maximum.
-     * 
-     * @see ConnManagerPNames#MAX_HOST_CONNECTIONS
-     */
-    public static int getDefaultMaxConnectionsPerHost(
-        final HttpParams params) {
-        return getMaxPerHost( params, ROUTE_DEFAULT);
-    }
-
-    /**
-     * Gets the maximum number of connections allowed for a specific route.
-     * If the value has not been specified for the given route, the default
-     * value will be returned.
+     * Returns maximum number of connections allowed per route lookup interface.
      * 
      * @param route     the route for which to get the maximum connections
      *
@@ -153,50 +86,16 @@
      * 
      * @see ConnManagerPNames#MAX_HOST_CONNECTIONS
      */
-    public static int getMaxConnectionsPerHost(final HttpParams params,
-                                               final HttpRoute route) {
-        if (route == null) {
-            throw new IllegalArgumentException
-                ("Route must not be null.");
-        }
-        return getMaxPerHost(params, route);
-    }
-
-
-    /**
-     * Internal getter for a max-per-host value.
-     *
-     * @param params    the parameters from which to get a max-per-host value
-     * @param key       the key, either an {@link HttpRoute} or
-     *                  {@link #ROUTE_DEFAULT}
-     *
-     * @return  the maximum for that key, or the default maximum
-     */
-    private static int getMaxPerHost(final HttpParams params,
-                                     final Object key) {
-        
+    public static ConnPerRoute getMaxConnectionsPerRoute(final HttpParams params) {
         if (params == null) {
             throw new IllegalArgumentException
                 ("HTTP parameters must not be null.");
         }
-
-        // if neither a specific nor a default maximum is configured...
-        int result = DEFAULT_MAX_HOST_CONNECTIONS;
-
-        Map<?,?> m = (Map<?,?>) params.getParameter
-            (ConnManagerPNames.MAX_HOST_CONNECTIONS);
-        if (m != null) {
-            Integer max = (Integer) m.get(key);
-            if ((max == null) && (key != ROUTE_DEFAULT)) {
-                // no specific maximum, get the configured default
-                max = (Integer) m.get(ROUTE_DEFAULT);
-            }
-            if (max != null) {
-                result = max.intValue();
-            }
+        ConnPerRoute connPerRoute = (ConnPerRoute) params.getParameter(MAX_CONNECTIONS_PER_ROUTE);
+        if (connPerRoute == null) {
+            connPerRoute = DEFAULT_CONN_PER_ROUTE;
         }
-
-        return result;
+        return connPerRoute;
     }
 
 
@@ -214,9 +113,7 @@
             throw new IllegalArgumentException
                 ("HTTP parameters must not be null.");
         }
-        params.setIntParameter(
-            ConnManagerPNames.MAX_TOTAL_CONNECTIONS,
-            maxTotalConnections);
+        params.setIntParameter(MAX_TOTAL_CONNECTIONS, maxTotalConnections);
     }
 
     /**
@@ -232,9 +129,8 @@
             throw new IllegalArgumentException
                 ("HTTP parameters must not be null.");
         }
-        return params.getIntParameter(
-            ConnManagerPNames.MAX_TOTAL_CONNECTIONS,
-            DEFAULT_MAX_TOTAL_CONNECTIONS);
+        return params.getIntParameter(MAX_TOTAL_CONNECTIONS, DEFAULT_MAX_TOTAL_CONNECTIONS);
     }
 
+    
 }

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/ConnPoolByRoute.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/ConnPoolByRoute.java?rev=647810&r1=647809&r2=647810&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/ConnPoolByRoute.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/ConnPoolByRoute.java Mon Apr 14 07:17:01 2008
@@ -45,6 +45,7 @@
 import org.apache.http.conn.ClientConnectionManager;
 import org.apache.http.conn.ClientConnectionOperator;
 import org.apache.http.conn.ConnectionPoolTimeoutException;
+import org.apache.http.conn.params.ConnPerRoute;
 import org.apache.http.conn.params.HttpConnectionManagerParams;
 
 
@@ -262,10 +263,13 @@
                                    Aborter aborter)
         throws ConnectionPoolTimeoutException, InterruptedException {
 
-        int maxHostConnections = HttpConnectionManagerParams
-            .getMaxConnectionsPerHost(this.params, route);
         int maxTotalConnections = HttpConnectionManagerParams
-            .getMaxTotalConnections(this.params);
+                .getMaxTotalConnections(this.params);
+        
+        ConnPerRoute connPerRoute = HttpConnectionManagerParams
+                .getMaxConnectionsPerRoute(params);
+        
+        int maxHostConnections = connPerRoute.getMaxForRoute(route);
         
         Date deadline = null;
         if (timeout > 0) {

Modified: httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/conn/params/TestAllConnParams.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/conn/params/TestAllConnParams.java?rev=647810&r1=647809&r2=647810&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/conn/params/TestAllConnParams.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/conn/params/TestAllConnParams.java Mon Apr 14 07:17:01 2008
@@ -43,7 +43,6 @@
     public static Test suite() {
         TestSuite suite = new TestSuite();
 
-        suite.addTest(TestParams.suite());
         suite.addTest(TestRouteParams.suite());
 
         return suite;

Modified: httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/conn/TestTSCCMNoServer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/conn/TestTSCCMNoServer.java?rev=647810&r1=647809&r2=647810&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/conn/TestTSCCMNoServer.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/conn/TestTSCCMNoServer.java Mon Apr 14 07:17:01 2008
@@ -42,6 +42,7 @@
 import org.apache.http.conn.ClientConnectionRequest;
 import org.apache.http.conn.ConnectionPoolTimeoutException;
 import org.apache.http.conn.ManagedClientConnection;
+import org.apache.http.conn.params.ConnPerRouteBean;
 import org.apache.http.conn.params.HttpConnectionManagerParams;
 import org.apache.http.conn.routing.HttpRoute;
 import org.apache.http.conn.scheme.PlainSocketFactory;
@@ -209,7 +210,7 @@
             throws InterruptedException, ConnectionPoolTimeoutException {
 
         HttpParams params = createDefaultParams();
-        HttpConnectionManagerParams.setDefaultMaxConnectionsPerHost(params, 1);
+        HttpConnectionManagerParams.setMaxConnectionsPerRoute(params, new ConnPerRouteBean(1));
         HttpConnectionManagerParams.setMaxTotalConnections(params, 2);
 
         ThreadSafeClientConnManager mgr = createTSCCM(params, null);
@@ -259,9 +260,12 @@
         
         HttpParams params = createDefaultParams();
         HttpConnectionManagerParams.setMaxTotalConnections(params, 100);
-        HttpConnectionManagerParams.setDefaultMaxConnectionsPerHost(params, 1);
-        HttpConnectionManagerParams.setMaxConnectionsPerHost(params,route2, 2);
-        HttpConnectionManagerParams.setMaxConnectionsPerHost(params,route3, 3);
+        
+        ConnPerRouteBean connPerRoute = new ConnPerRouteBean(1);
+        connPerRoute.setMaxForRoute(route2, 2);
+        connPerRoute.setMaxForRoute(route3, 3);
+        
+        HttpConnectionManagerParams.setMaxConnectionsPerRoute(params, connPerRoute);
 
         ThreadSafeClientConnManager mgr = createTSCCM(params, null);
 
@@ -326,7 +330,7 @@
     public void testReleaseConnection() throws Exception {
 
         HttpParams params = createDefaultParams();
-        HttpConnectionManagerParams.setDefaultMaxConnectionsPerHost(params, 1);
+        HttpConnectionManagerParams.setMaxConnectionsPerRoute(params, new ConnPerRouteBean(1));
         HttpConnectionManagerParams.setMaxTotalConnections(params, 3);
 
         ThreadSafeClientConnManager mgr = createTSCCM(params, null);
@@ -430,7 +434,7 @@
         // 3.x: TestHttpConnectionManager.testShutdown
 
         HttpParams params = createDefaultParams();
-        HttpConnectionManagerParams.setDefaultMaxConnectionsPerHost(params, 1);
+        HttpConnectionManagerParams.setMaxConnectionsPerRoute(params, new ConnPerRouteBean(1));
         HttpConnectionManagerParams.setMaxTotalConnections(params, 1);
 
         ThreadSafeClientConnManager mgr = createTSCCM(params, null);

Modified: httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/conn/TestTSCCMWithServer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/conn/TestTSCCMWithServer.java?rev=647810&r1=647809&r2=647810&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/conn/TestTSCCMWithServer.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/conn/TestTSCCMWithServer.java Mon Apr 14 07:17:01 2008
@@ -48,6 +48,7 @@
 import org.apache.http.conn.ClientConnectionManager;
 import org.apache.http.conn.ClientConnectionRequest;
 import org.apache.http.conn.ManagedClientConnection;
+import org.apache.http.conn.params.ConnPerRouteBean;
 import org.apache.http.conn.params.HttpConnectionManagerParams;
 import org.apache.http.localserver.ServerTestBase;
 import org.apache.http.message.BasicHttpRequest;
@@ -125,8 +126,8 @@
         HttpParams mgrpar = defaultParams.copy();
         HttpConnectionManagerParams.setMaxTotalConnections
             (mgrpar, COUNT/2);
-        HttpConnectionManagerParams.setDefaultMaxConnectionsPerHost
-            (mgrpar, COUNT/2);
+        HttpConnectionManagerParams.setMaxConnectionsPerRoute
+            (mgrpar, new ConnPerRouteBean(COUNT/2));
         ThreadSafeClientConnManager mgr = createTSCCM(mgrpar, null);
 
         final HttpHost target = getServerHttp();

Modified: httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/conn/tsccm/TestSpuriousWakeup.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/conn/tsccm/TestSpuriousWakeup.java?rev=647810&r1=647809&r2=647810&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/conn/tsccm/TestSpuriousWakeup.java (original)
+++ httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/conn/tsccm/TestSpuriousWakeup.java Mon Apr 14 07:17:01 2008
@@ -47,6 +47,7 @@
 import org.apache.http.conn.scheme.Scheme;
 import org.apache.http.conn.scheme.SchemeRegistry;
 import org.apache.http.conn.scheme.SocketFactory;
+import org.apache.http.conn.params.ConnPerRouteBean;
 import org.apache.http.conn.params.HttpConnectionManagerParams;
 import org.apache.http.params.BasicHttpParams;
 import org.apache.http.params.HttpParams;
@@ -140,7 +141,7 @@
         HttpParams params = new BasicHttpParams();
         HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
         HttpProtocolParams.setUseExpectContinue(params, false);
-        HttpConnectionManagerParams.setDefaultMaxConnectionsPerHost(params, 1);
+        HttpConnectionManagerParams.setMaxConnectionsPerRoute(params, new ConnPerRouteBean(1));
         HttpConnectionManagerParams.setMaxTotalConnections(params, 1);
 
         SchemeRegistry schreg = new SchemeRegistry();