hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rola...@apache.org
Subject svn commit: r607430 - in /httpcomponents/httpclient/trunk/module-client/src: main/java/org/apache/http/conn/ main/java/org/apache/http/impl/client/ main/java/org/apache/http/impl/conn/ main/java/org/apache/http/impl/conn/tsccm/ test/java/org/apache/htt...
Date Sat, 29 Dec 2007 15:39:11 GMT
Author: rolandw
Date: Sat Dec 29 07:39:11 2007
New Revision: 607430

URL: http://svn.apache.org/viewvc?rev=607430&view=rev
Log:
HTTPCLIENT-725: time unit when getting a connection

Modified:
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/ClientConnectionManager.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/DefaultClientRequestDirector.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/SingleClientConnManager.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/AbstractConnPool.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/ConnPoolByRoute.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/ThreadSafeClientConnManager.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/WaitingThread.java
    httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/conn/GetConnThread.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

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/ClientConnectionManager.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/ClientConnectionManager.java?rev=607430&r1=607429&r2=607430&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/ClientConnectionManager.java
(original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/ClientConnectionManager.java
Sat Dec 29 07:39:11 2007
@@ -32,6 +32,8 @@
 package org.apache.http.conn;
 
 
+import java.util.concurrent.TimeUnit;
+
 import org.apache.http.params.HttpParams;
 
 
@@ -93,9 +95,12 @@
      * This method will block until a connection becomes available,
      * the timeout expires, or the connection manager is
      * {@link #shutdown shut down}.
+     * Timeouts are handled with millisecond precision
      *
      * @param route     where the connection should point to
-     * @param timeout   the timeout in milliseconds
+     * @param timeout   the timeout, 0 or negative for no timeout
+     * @param tunit     the unit for the <code>timeout</code>,
+     *                  may be <code>null</code> only if there is no timeout
      *
      * @return  a connection that can be used to communicate
      *          along the given route
@@ -106,7 +111,8 @@
      *         if the calling thread is interrupted while waiting
      */
     ManagedClientConnection getConnection(HttpRoute route,
-                                          long timeout)
+                                          long timeout,
+                                          TimeUnit tunit)
         throws ConnectionPoolTimeoutException, InterruptedException
         ;
 

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/DefaultClientRequestDirector.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/DefaultClientRequestDirector.java?rev=607430&r1=607429&r2=607430&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/DefaultClientRequestDirector.java
(original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/DefaultClientRequestDirector.java
Sat Dec 29 07:39:11 2007
@@ -35,6 +35,7 @@
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.Map;
+import java.util.concurrent.TimeUnit;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -501,6 +502,8 @@
      * Obtains a connection for the target route.
      *
      * @param route     the route for which to allocate a connection
+     * @param timeout   the timeout in milliseconds,
+     *                  0 or negative for no timeout
      *
      * @throws HttpException    in case of a (protocol) problem
      * @throws ConnectionPoolTimeoutException   in case of a timeout
@@ -511,7 +514,8 @@
         throws HttpException, ConnectionPoolTimeoutException,
                InterruptedException {
 
-        return connManager.getConnection(route, timeout);
+        return connManager.getConnection
+            (route, timeout, TimeUnit.MILLISECONDS);
 
     } // allocateConnection
 

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/SingleClientConnManager.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/SingleClientConnManager.java?rev=607430&r1=607429&r2=607430&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/SingleClientConnManager.java
(original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/SingleClientConnManager.java
Sat Dec 29 07:39:11 2007
@@ -32,6 +32,7 @@
 package org.apache.http.impl.conn;
 
 import java.io.IOException;
+import java.util.concurrent.TimeUnit;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -183,12 +184,14 @@
      *
      * @param route     where the connection should point to
      * @param timeout   ignored
+     * @param tunit     ignored
      *
      * @return  a connection that can be used to communicate
      *          along the given route
      */
     public final ManagedClientConnection getConnection(HttpRoute route,
-                                                       long timeout) {
+                                                       long timeout,
+                                                       TimeUnit tunit) {
         return getConnection(route);
     }
 

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/AbstractConnPool.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/AbstractConnPool.java?rev=607430&r1=607429&r2=607430&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/AbstractConnPool.java
(original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/AbstractConnPool.java
Sat Dec 29 07:39:11 2007
@@ -37,6 +37,7 @@
 import java.util.Set;
 import java.util.HashSet;
 import java.util.Iterator;
+import java.util.concurrent.TimeUnit;
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantLock;
 
@@ -167,7 +168,9 @@
      * Obtains a pool entry with a connection within the given timeout.
      *
      * @param route     the route for which to get the connection
-     * @param timeout   the timeout, or 0 for no timeout
+     * @param timeout   the timeout, 0 or negative for no timeout
+     * @param tunit     the unit for the <code>timeout</code>,
+     *                  may be <code>null</code> only if there is no timeout
      * @param operator  the connection operator, in case
      *                  a connection has to be created
      *
@@ -179,7 +182,7 @@
      *         if the calling thread was interrupted
      */
     public abstract
-        BasicPoolEntry getEntry(HttpRoute route, long timeout,
+        BasicPoolEntry getEntry(HttpRoute route, long timeout, TimeUnit tunit,
                                 ClientConnectionOperator operator)
         throws ConnectionPoolTimeoutException, InterruptedException
         ;

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=607430&r1=607429&r2=607430&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
Sat Dec 29 07:39:11 2007
@@ -208,7 +208,8 @@
 
 
     // non-javadoc, see base class AbstractConnPool
-    public BasicPoolEntry getEntry(HttpRoute route, long timeout,
+    public BasicPoolEntry getEntry(HttpRoute route,
+                                   long timeout, TimeUnit tunit,
                                    ClientConnectionOperator operator)
         throws ConnectionPoolTimeoutException, InterruptedException {
 
@@ -219,7 +220,8 @@
         
         Date deadline = null;
         if (timeout > 0) {
-            deadline = new Date(System.currentTimeMillis() + timeout);
+            deadline = new Date
+                (System.currentTimeMillis() + tunit.toMillis(timeout));
         }
 
         BasicPoolEntry entry = null;

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/ThreadSafeClientConnManager.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/ThreadSafeClientConnManager.java?rev=607430&r1=607429&r2=607430&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/ThreadSafeClientConnManager.java
(original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/ThreadSafeClientConnManager.java
Sat Dec 29 07:39:11 2007
@@ -31,6 +31,7 @@
 package org.apache.http.impl.conn.tsccm;
 
 import java.io.IOException;
+import java.util.concurrent.TimeUnit;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -146,13 +147,13 @@
 
         while (true) {
             try {
-                return getConnection(route, 0);
+                return getConnection(route, 0, null);
             } catch (ConnectionPoolTimeoutException e) {
                 // We'll go ahead and log this, but it should never happen.
                 // These exceptions are only thrown when the timeout occurs
                 // and since we have no timeout, it doesn't happen.
                 LOG.debug
-                    ("Unexpected exception while waiting for connection", e);
+                    ("Unexpected exception while waiting for connection.", e);
                 //@@@ throw RuntimeException or Error to indicate the problem?
             }
         }
@@ -161,7 +162,8 @@
 
     // non-javadoc, see interface ClientConnectionManager
     public ManagedClientConnection getConnection(HttpRoute route,
-                                                 long timeout)
+                                                 long timeout,
+                                                 TimeUnit tunit)
         throws ConnectionPoolTimeoutException, InterruptedException {
 
         if (route == null) {
@@ -174,7 +176,7 @@
         }
 
         final BasicPoolEntry entry =
-            connectionPool.getEntry(route, timeout, connOperator);
+            connectionPool.getEntry(route, timeout, tunit, connOperator);
 
         return new BasicPooledConnAdapter(this, entry);
     }

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/WaitingThread.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/WaitingThread.java?rev=607430&r1=607429&r2=607430&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/WaitingThread.java
(original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/WaitingThread.java
Sat Dec 29 07:39:11 2007
@@ -32,7 +32,6 @@
 
 
 import java.util.Date;
-import java.util.concurrent.TimeUnit;
 import java.util.concurrent.locks.Condition;
 
 

Modified: httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/conn/GetConnThread.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/conn/GetConnThread.java?rev=607430&r1=607429&r2=607430&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/conn/GetConnThread.java
(original)
+++ httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/conn/GetConnThread.java
Sat Dec 29 07:39:11 2007
@@ -30,6 +30,8 @@
 
 package org.apache.http.impl.conn;
 
+import java.util.concurrent.TimeUnit;
+
 import org.apache.http.conn.ClientConnectionManager;
 import org.apache.http.conn.HttpRoute;
 import org.apache.http.conn.ManagedClientConnection;
@@ -52,6 +54,7 @@
     /**
      * Creates a new thread.
      * When this thread is started, it will try to obtain a connection.
+     * The timeout is in milliseconds.
      */
     public GetConnThread(ClientConnectionManager mgr,
                          HttpRoute route, long timeout) {
@@ -67,7 +70,8 @@
      */
     public void run() {
         try {
-            connection = conn_manager.getConnection(conn_route, conn_timeout);
+            connection = conn_manager.getConnection
+                (conn_route, conn_timeout, TimeUnit.MILLISECONDS);
         } catch (Throwable dart) {
             exception = dart;
         }

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=607430&r1=607429&r2=607430&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
Sat Dec 29 07:39:11 2007
@@ -30,6 +30,8 @@
 
 package org.apache.http.impl.conn;
 
+import java.util.concurrent.TimeUnit;
+
 import junit.framework.Test;
 import junit.framework.TestCase;
 import junit.framework.TestSuite;
@@ -204,7 +206,7 @@
 
         try {
             // this should fail quickly, connection has not been released
-            mgr.getConnection(route2, 100L);
+            mgr.getConnection(route2, 100L, TimeUnit.MILLISECONDS);
             fail("ConnectionPoolTimeoutException should have been thrown");
         } catch (ConnectionPoolTimeoutException e) {
             // expected
@@ -216,7 +218,7 @@
 
         // there should be a connection available now
         try {
-            conn2 = mgr.getConnection(route2, 100L);
+            conn2 = mgr.getConnection(route2, 100L, TimeUnit.MILLISECONDS);
         } catch (ConnectionPoolTimeoutException cptx) {
             cptx.printStackTrace();
             fail("connection should have been available: " + cptx);
@@ -244,36 +246,39 @@
         ThreadSafeClientConnManager mgr = createTSCCM(params, null);
 
         // route 3, limit 3
-        ManagedClientConnection conn1 = mgr.getConnection(route3, 10L);
+        ManagedClientConnection conn1 =
+            mgr.getConnection(route3, 10L, TimeUnit.MILLISECONDS);
         assertNotNull(conn1);
-        ManagedClientConnection conn2 = mgr.getConnection(route3, 10L);
+        ManagedClientConnection conn2 =
+            mgr.getConnection(route3, 10L, TimeUnit.MILLISECONDS);
         assertNotNull(conn2);
-        ManagedClientConnection conn3 = mgr.getConnection(route3, 10L);
+        ManagedClientConnection conn3 =
+            mgr.getConnection(route3, 10L, TimeUnit.MILLISECONDS);
         assertNotNull(conn3);
         try {
             // should fail quickly, connection has not been released
-            mgr.getConnection(route3, 10L);
+            mgr.getConnection(route3, 10L, TimeUnit.MILLISECONDS);
             fail("ConnectionPoolTimeoutException should have been thrown");
         } catch (ConnectionPoolTimeoutException e) {
             // expected
         }
         
         // route 2, limit 2
-        conn1 = mgr.getConnection(route2, 10L);
-        conn2 = mgr.getConnection(route2, 10L);
+        conn1 = mgr.getConnection(route2, 10L, TimeUnit.MILLISECONDS);
+        conn2 = mgr.getConnection(route2, 10L, TimeUnit.MILLISECONDS);
         try {
             // should fail quickly, connection has not been released
-            mgr.getConnection(route2, 10L);
+            mgr.getConnection(route2, 10L, TimeUnit.MILLISECONDS);
             fail("ConnectionPoolTimeoutException should have been thrown");
         } catch (ConnectionPoolTimeoutException e) {
             // expected
         }
 
         // route 1, should use default limit of 1
-        conn1 = mgr.getConnection(route1, 10L);
+        conn1 = mgr.getConnection(route1, 10L, TimeUnit.MILLISECONDS);
         try {
             // should fail quickly, connection has not been released
-            mgr.getConnection(route1, 10L);
+            mgr.getConnection(route1, 10L, TimeUnit.MILLISECONDS);
             fail("ConnectionPoolTimeoutException should have been thrown");
         } catch (ConnectionPoolTimeoutException e) {
             // expected
@@ -314,9 +319,12 @@
         HttpRoute route3 = new HttpRoute(target3, null, false);
 
         // the first three allocations should pass
-        ManagedClientConnection conn1 = mgr.getConnection(route1, 10L);
-        ManagedClientConnection conn2 = mgr.getConnection(route2, 10L);
-        ManagedClientConnection conn3 = mgr.getConnection(route3, 10L);
+        ManagedClientConnection conn1 =
+            mgr.getConnection(route1, 10L, TimeUnit.MILLISECONDS);
+        ManagedClientConnection conn2 =
+            mgr.getConnection(route2, 10L, TimeUnit.MILLISECONDS);
+        ManagedClientConnection conn3 =
+            mgr.getConnection(route3, 10L, TimeUnit.MILLISECONDS);
         assertNotNull(conn1);
         assertNotNull(conn2);
         assertNotNull(conn3);
@@ -324,19 +332,19 @@
         // obtaining another connection for either of the three should fail
         // this is somehow redundant with testMaxConnPerHost
         try {
-            mgr.getConnection(route1, 10L);
+            mgr.getConnection(route1, 10L, TimeUnit.MILLISECONDS);
             fail("ConnectionPoolTimeoutException should have been thrown");
         } catch (ConnectionPoolTimeoutException e) {
             // expected
         }
         try {
-            mgr.getConnection(route2, 10L);
+            mgr.getConnection(route2, 10L, TimeUnit.MILLISECONDS);
             fail("ConnectionPoolTimeoutException should have been thrown");
         } catch (ConnectionPoolTimeoutException e) {
             // expected
         }
         try {
-            mgr.getConnection(route3, 10L);
+            mgr.getConnection(route3, 10L, TimeUnit.MILLISECONDS);
             fail("ConnectionPoolTimeoutException should have been thrown");
         } catch (ConnectionPoolTimeoutException e) {
             // expected
@@ -346,16 +354,16 @@
         mgr.releaseConnection(conn2);
         conn2 = null;
         try {
-            mgr.getConnection(route1, 10L);
+            mgr.getConnection(route1, 10L, TimeUnit.MILLISECONDS);
             fail("ConnectionPoolTimeoutException should have been thrown");
         } catch (ConnectionPoolTimeoutException e) {
             // expected
         }
         // this one succeeds
-        conn2 = mgr.getConnection(route2, 10L);
+        conn2 = mgr.getConnection(route2, 10L, TimeUnit.MILLISECONDS);
         assertNotNull(conn2);
         try {
-            mgr.getConnection(route3, 10L);
+            mgr.getConnection(route3, 10L, TimeUnit.MILLISECONDS);
             fail("ConnectionPoolTimeoutException should have been thrown");
         } catch (ConnectionPoolTimeoutException e) {
             // expected
@@ -411,7 +419,8 @@
         // get the only connection, then start an extra thread
         // on shutdown, the extra thread should get an exception
 
-        ManagedClientConnection conn = mgr.getConnection(route, 1L);
+        ManagedClientConnection conn =
+            mgr.getConnection(route, 1L, TimeUnit.MILLISECONDS);
         GetConnThread gct = new GetConnThread(mgr, route, 0L); // no timeout
         gct.start();
         Thread.sleep(100); // give extra thread time to block
@@ -435,7 +444,7 @@
 
         // the manager is down, we should not be able to get a connection
         try {
-            conn = mgr.getConnection(route, 1L);
+            conn = mgr.getConnection(route, 1L, TimeUnit.MILLISECONDS);
             fail("shut-down manager does not raise exception");
         } catch (IllegalStateException isx) {
             // expected
@@ -455,7 +464,8 @@
         HttpRoute route = new HttpRoute(target, null, false);
 
         // get the only connection, then start an extra thread
-        ManagedClientConnection conn = mgr.getConnection(route, 1L);
+        ManagedClientConnection conn =
+            mgr.getConnection(route, 1L, TimeUnit.MILLISECONDS);
         GetConnThread gct = new GetConnThread(mgr, route, 0L); // no timeout
         gct.start();
         Thread.sleep(100); // give extra thread time to block
@@ -474,14 +484,15 @@
 
         // make sure the manager is still working
         try {
-            mgr.getConnection(route, 10L);
+            mgr.getConnection(route, 10L, TimeUnit.MILLISECONDS);
             fail("should have gotten a timeout");
         } catch (ConnectionPoolTimeoutException e) {
             // expected
         }
 
         mgr.releaseConnection(conn);
-        conn = mgr.getConnection(route, 10L); // this time, no exception
+        // this time: no exception
+        conn = mgr.getConnection(route, 10L, TimeUnit.MILLISECONDS);
         assertNotNull("should have gotten a connection", conn);
 
         mgr.shutdown();
@@ -503,7 +514,8 @@
         HttpRoute route2 = new HttpRoute(target2, null, false);
 
         // get the only connection, then start two extra threads
-        ManagedClientConnection conn = mgr.getConnection(route1, 1L);
+        ManagedClientConnection conn =
+            mgr.getConnection(route1, 1L, TimeUnit.MILLISECONDS);
         GetConnThread gct1 = new GetConnThread(mgr, route1, 1000L);
         GetConnThread gct2 = new GetConnThread(mgr, route2, 1000L);
 

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=607430&r1=607429&r2=607430&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
Sat Dec 29 07:39:11 2007
@@ -32,6 +32,7 @@
 
 
 import java.lang.ref.WeakReference;
+import java.util.concurrent.TimeUnit;
 
 import junit.framework.Test;
 import junit.framework.TestSuite;
@@ -211,7 +212,7 @@
         // check that there is no auto-release by default
         try {
             // this should fail quickly, connection has not been released
-            mgr.getConnection(route, 10L);
+            mgr.getConnection(route, 10L, TimeUnit.MILLISECONDS);
             fail("ConnectionPoolTimeoutException should have been thrown");
         } catch (ConnectionPoolTimeoutException e) {
             // expected
@@ -295,7 +296,7 @@
         // first check that we can't get another connection
         try {
             // this should fail quickly, connection has not been released
-            mgr.getConnection(route, 10L);
+            mgr.getConnection(route, 10L, TimeUnit.MILLISECONDS);
             fail("ConnectionPoolTimeoutException should have been thrown");
         } catch (ConnectionPoolTimeoutException e) {
             // expected
@@ -314,7 +315,7 @@
         Thread.sleep(1000);
 
         assertNull("connection not garbage collected", wref.get());
-        conn = mgr.getConnection(route, 10L);
+        conn = mgr.getConnection(route, 10L, TimeUnit.MILLISECONDS);
         assertFalse("GCed connection not closed", conn.isOpen());
 
         mgr.shutdown();



Mime
View raw message