hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sber...@apache.org
Subject svn commit: r672367 - 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/ test/java/org/apache/http/impl/client/ test/java/org/apache/http/im...
Date Fri, 27 Jun 2008 19:49:21 GMT
Author: sberlin
Date: Fri Jun 27 12:49:20 2008
New Revision: 672367

URL: http://svn.apache.org/viewvc?rev=672367&view=rev
Log:
simplified keep-alive support.  changed ConnectionKeepAliveStrategy to return time in ms,
instead of time & timeunit in two different calls.  reverted ConnectionReleaseTrigger.releaseConnection
to take zero params & instead added a setIdleDuration method to ManagedClientConnection,
along with converting direct uses of ClientConnectionManager.releaseConnection to instead
go through ManagedClientConnection.releaseConnection (which now uses the idle time when giving
itself to the manager).

Modified:
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/BasicEofSensorWatcher.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/BasicManagedEntity.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/ConnectionKeepAliveStrategy.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/ConnectionReleaseTrigger.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/EofSensorInputStream.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/ManagedClientConnection.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/client/DefaultConnectionKeepAliveStrategy.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/AbstractClientConnAdapter.java
    httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/client/TestDefaultClientRequestDirector.java
    httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/client/TestDefaultConnKeepAliveStrategy.java
    httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/conn/ClientConnAdapterMockup.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/BasicEofSensorWatcher.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/BasicEofSensorWatcher.java?rev=672367&r1=672366&r2=672367&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/BasicEofSensorWatcher.java
(original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/BasicEofSensorWatcher.java
Fri Jun 27 12:49:20 2008
@@ -86,7 +86,7 @@
                 managedConn.markReusable();
             }
         } finally {
-            managedConn.releaseConnection(-1, null);
+            managedConn.releaseConnection();
         }
         return false;
     }
@@ -104,7 +104,7 @@
                 managedConn.markReusable();
             }
         } finally {
-            managedConn.releaseConnection(-1, null);
+            managedConn.releaseConnection();
         }
         return false;
     }

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/BasicManagedEntity.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/BasicManagedEntity.java?rev=672367&r1=672366&r2=672367&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/BasicManagedEntity.java
(original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/BasicManagedEntity.java
Fri Jun 27 12:49:20 2008
@@ -30,10 +30,9 @@
 
 package org.apache.http.conn;
 
-import java.io.InputStream;
 import java.io.IOException;
+import java.io.InputStream;
 import java.io.OutputStream;
-import java.util.concurrent.TimeUnit;
 
 import org.apache.http.HttpEntity;
 import org.apache.http.entity.HttpEntityWrapper;
@@ -61,12 +60,6 @@
 
     /** Whether to keep the connection alive. */
     protected final boolean attemptReuse;
-    
-    /** The duration this is valid for. */
-    protected final long validDuration;
-    
-    /** The unit of time the duration is valid for. */
-    protected final TimeUnit validUnit;
 
 
     /**
@@ -81,9 +74,7 @@
      */
     public BasicManagedEntity(HttpEntity entity,
                               ManagedClientConnection conn,
-                              boolean reuse,
-                              long validDuration,
-                              TimeUnit validUnit) {
+                              boolean reuse) {
         super(entity);
 
         if (conn == null)
@@ -92,8 +83,6 @@
 
         this.managedConn = conn;
         this.attemptReuse = reuse;
-        this.validDuration = validDuration;
-        this.validUnit = validUnit;
     }
 
 
@@ -140,7 +129,7 @@
 
 
     // non-javadoc, see interface ConnectionReleaseTrigger
-    public void releaseConnection(long validDuration, TimeUnit timeUnit)
+    public void releaseConnection()
         throws IOException {
 
         this.consumeContent();
@@ -221,11 +210,7 @@
 
         if (managedConn != null) {
             try {
-                // TODO: Should this be subtracting the elapsed time from
-                //       when the entity was created till now?
-                //       There's no good specification for when the 'timeout'
-                //       starts counting.
-                managedConn.releaseConnection(validDuration, validUnit);
+                managedConn.releaseConnection();
             } finally {
                 managedConn = null;
             }

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/ConnectionKeepAliveStrategy.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/ConnectionKeepAliveStrategy.java?rev=672367&r1=672366&r2=672367&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/ConnectionKeepAliveStrategy.java
(original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/ConnectionKeepAliveStrategy.java
Fri Jun 27 12:49:20 2008
@@ -30,8 +30,6 @@
  */
 package org.apache.http.conn;
 
-import java.util.concurrent.TimeUnit;
-
 import org.apache.http.ConnectionReuseStrategy;
 import org.apache.http.HttpResponse;
 import org.apache.http.protocol.HttpContext;
@@ -48,9 +46,6 @@
  * @since 4.0
  */
 public interface ConnectionKeepAliveStrategy {
-
-    /** Returns the TimeUnit that this uses for specifying duration. */
-    TimeUnit getTimeUnit();
     
     /**
      * Returns the duration of time which this connection can be safely kept
@@ -68,8 +63,8 @@
      * @param context
      *            the context in which the connection is being used.
      * 
-     * @return the duration which it is safe to keep the connection idle,
-     *         or <=0 if no suggested duration.
+     * @return the duration in ms for which it is safe to keep the connection
+     *         idle, or <=0 if no suggested duration.
      */
     long getKeepAliveDuration(HttpResponse response, HttpContext context);
     

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/ConnectionReleaseTrigger.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/ConnectionReleaseTrigger.java?rev=672367&r1=672366&r2=672367&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/ConnectionReleaseTrigger.java
(original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/ConnectionReleaseTrigger.java
Fri Jun 27 12:49:20 2008
@@ -31,7 +31,6 @@
 package org.apache.http.conn;
 
 import java.io.IOException;
-import java.util.concurrent.TimeUnit;
 
 
 /**
@@ -63,16 +62,11 @@
      * {@link #abortConnection abortConnection} for a hard release. The
      * connection may be reused as specified by the duration.
      * 
-     * @param validDuration
-     *            The duration of time this connection is valid to be reused.
-     * @param timeUnit
-     *            The time unit the duration is measured in.
-     * 
      * @throws IOException
      *             in case of an IO problem. The connection will be released
      *             anyway.
      */
-    void releaseConnection(long validDuration, TimeUnit timeUnit)
+    void releaseConnection()
         throws IOException
         ;
 

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/EofSensorInputStream.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/EofSensorInputStream.java?rev=672367&r1=672366&r2=672367&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/EofSensorInputStream.java
(original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/EofSensorInputStream.java
Fri Jun 27 12:49:20 2008
@@ -32,7 +32,6 @@
 
 import java.io.InputStream;
 import java.io.IOException;
-import java.util.concurrent.TimeUnit;
 
 
 /**
@@ -306,7 +305,7 @@
     /**
      * Same as {@link #close close()}.
      */
-    public void releaseConnection(long validDuration, TimeUnit timeUnit) throws IOException
{
+    public void releaseConnection() throws IOException {
         this.close();
     }
 

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/ManagedClientConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/ManagedClientConnection.java?rev=672367&r1=672366&r2=672367&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/ManagedClientConnection.java
(original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/ManagedClientConnection.java
Fri Jun 27 12:49:20 2008
@@ -32,6 +32,8 @@
 package org.apache.http.conn;
 
 import java.io.IOException;
+import java.util.concurrent.TimeUnit;
+
 import javax.net.ssl.SSLSession;
 
 import org.apache.http.HttpClientConnection;
@@ -245,5 +247,12 @@
      */
     Object getState()
         ;
+    
+    /**
+     * Sets the duration that this connection can remain idle
+     * before it is reused.
+     * The connection should not be used again if this time elapses.
+     */
+    void setIdleDuration(long duration, TimeUnit unit);
 
 } // interface ManagedClientConnection

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=672367&r1=672366&r2=672367&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
Fri Jun 27 12:49:20 2008
@@ -298,6 +298,7 @@
         
         int execCount = 0;
         
+        boolean reuse = false;
         HttpResponse response = null;
         boolean done = false;
         try {
@@ -445,11 +446,19 @@
                 response.setParams(params);
                 requestExec.postProcess(response, httpProcessor, context);
                 
+
+                // The connection is in or can be brought to a re-usable state.
+                reuse = reuseStrategy.keepAlive(response, context);
+                if(reuse) {
+                    // Set the idle duration of this connection
+                    long duration = keepAliveStrategy.getKeepAliveDuration(response, context);
+                    managedConn.setIdleDuration(duration, TimeUnit.MILLISECONDS);
+                }
+                
                 RoutedRequest followup = handleResponse(roureq, response, context);
                 if (followup == null) {
                     done = true;
                 } else {
-                    boolean reuse = reuseStrategy.keepAlive(response, context);
                     if (reuse) {
                         LOG.debug("Connection kept alive");
                         // Make sure the response body is fully consumed, if present
@@ -465,7 +474,7 @@
                     }
                     // check if we can use the same connection for the followup
                     if (!followup.getRoute().equals(roureq.getRoute())) {
-                        releaseConnection(response, context);
+                        releaseConnection();
                     }
                     roureq = followup;
                 }
@@ -477,8 +486,6 @@
                 }
             } // while not done
 
-            // The connection is in or can be brought to a re-usable state.
-            boolean reuse = reuseStrategy.keepAlive(response, context);
 
             // check for entity, release connection if possible
             if ((response == null) || (response.getEntity() == null) ||
@@ -486,13 +493,11 @@
                 // connection not needed and (assumed to be) in re-usable state
                 if (reuse)
                     managedConn.markReusable();
-                releaseConnection(response, context);
+                releaseConnection();
             } else {
                 // install an auto-release entity
                 HttpEntity entity = response.getEntity();
-                long duration = keepAliveStrategy.getKeepAliveDuration(response, context);
-                TimeUnit unit = keepAliveStrategy.getTimeUnit();
-                entity = new BasicManagedEntity(entity, managedConn, reuse, duration, unit);
+                entity = new BasicManagedEntity(entity, managedConn, reuse);
                 response.setEntity(entity);
             }
 
@@ -515,10 +520,15 @@
      * and prepares for retrieving a new connection during
      * the next request.
      */
-    protected void releaseConnection(HttpResponse response, HttpContext context) {
-        long duration = keepAliveStrategy.getKeepAliveDuration(response, context);
-        TimeUnit unit = keepAliveStrategy.getTimeUnit();
-        connManager.releaseConnection(managedConn, duration, unit);
+    protected void releaseConnection() {
+        // Release the connection through the ManagedConnection instead of the
+        // ConnectionManager directly.  This lets the connection control how
+        // it is released.
+        try {
+            managedConn.releaseConnection();
+        } catch(IOException ignored) {
+            LOG.debug("IOException releasing connection", ignored);
+        }
         managedConn = null;
     }
 
@@ -980,10 +990,8 @@
      * Shuts down the connection.
      * This method is called from a <code>catch</code> block in
      * {@link #execute execute} during exception handling.
-     *
-     * @throws IOException      in case of an IO problem
      */
-    private void abortConnection() throws IOException {
+    private void abortConnection() {
         ManagedClientConnection mcc = managedConn;
         if (mcc != null) {
             // we got here as the result of an exception
@@ -997,7 +1005,11 @@
                 }
             }
             // ensure the connection manager properly releases this connection
-            connManager.releaseConnection(mcc, -1, null);
+            try {
+                mcc.releaseConnection();
+            } catch(IOException ignored) {
+                LOG.debug("Error releasing connection", ignored);
+            }
         }
     } // abortConnection
 

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/DefaultConnectionKeepAliveStrategy.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/DefaultConnectionKeepAliveStrategy.java?rev=672367&r1=672366&r2=672367&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/DefaultConnectionKeepAliveStrategy.java
(original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/DefaultConnectionKeepAliveStrategy.java
Fri Jun 27 12:49:20 2008
@@ -30,8 +30,6 @@
  */
 package org.apache.http.impl.client;
 
-import java.util.concurrent.TimeUnit;
-
 import org.apache.http.HeaderElement;
 import org.apache.http.HeaderElementIterator;
 import org.apache.http.HttpResponse;
@@ -67,16 +65,12 @@
             String value = he.getValue();
             if (value != null && param.equalsIgnoreCase("timeout")) {
                 try {
-                    return Long.parseLong(value);
+                    return Long.parseLong(value) * 1000;
                 } catch(NumberFormatException ignore) {
                 }
             }
         }
         return -1;
     }
-    
-    public TimeUnit getTimeUnit() {
-        return TimeUnit.SECONDS;
-    }
 
 }

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/AbstractClientConnAdapter.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/AbstractClientConnAdapter.java?rev=672367&r1=672366&r2=672367&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/AbstractClientConnAdapter.java
(original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/AbstractClientConnAdapter.java
Fri Jun 27 12:49:20 2008
@@ -98,6 +98,12 @@
 
     /** True if the connection has been aborted. */
     private volatile boolean aborted;
+    
+    /** The last time this processed incoming headers. */
+    private volatile long lastHeadersRead;
+    
+    /** The duration this is valid for while idle (in ms). */
+    private volatile long duration;
 
     /**
      * Creates a new connection adapter.
@@ -115,7 +121,7 @@
         wrappedConnection = conn;
         markedReusable = false;
         aborted = false;
-
+        duration = Long.MAX_VALUE;
     } // <constructor>
 
 
@@ -126,6 +132,7 @@
     protected void detach() {
         wrappedConnection = null;
         connManager = null; // base class attribute
+        duration = Long.MAX_VALUE;
     }
 
     protected OperatedClientConnection getWrappedConnection() {
@@ -252,6 +259,8 @@
         assertValid(conn);
 
         unmarkReusable();
+        duration = Long.MAX_VALUE; // Reset duration per request.
+        lastHeadersRead = System.currentTimeMillis();
         return conn.receiveResponseHeader();
     }
 
@@ -347,11 +356,45 @@
     public boolean isMarkedReusable() {
         return markedReusable;
     }
+    
+    public void setIdleDuration(long duration, TimeUnit unit) {
+        if(duration > 0) {
+            this.duration = unit.toMillis(duration);
+        } else {
+            this.duration = Long.MAX_VALUE;
+        }
+    }
+    
+    /**
+     * Returns the amount of time remaining that this connection
+     * can be reused.  If negative, the connection should not
+     * be reused.  If Long.MAX_VALUE, there is no suggested
+     * duration.
+     * 
+     * The remaining time is the elapsed time between now,
+     * the time the last headers were processed, and the duration
+     * given from {@link #setIdleDuration(long, TimeUnit)}.
+     */
+    protected long getRemainingIdleDuration() {
+        if(duration == Long.MAX_VALUE) {
+            return Long.MAX_VALUE;
+        } else {
+            long elapsedAlready = System.currentTimeMillis() - lastHeadersRead;
+            return duration - elapsedAlready;
+        }
+    }
 
     // non-javadoc, see interface ConnectionReleaseTrigger
-    public void releaseConnection(long validDuration, TimeUnit timeUnit) {
-        if (connManager != null)
-            connManager.releaseConnection(this, validDuration, timeUnit);
+    public void releaseConnection() {
+        if (connManager != null) {
+            long remainingTime = getRemainingIdleDuration();
+            if(remainingTime <= 0) {
+                unmarkReusable();
+            } else if(remainingTime == Long.MAX_VALUE) {
+                remainingTime = -1;
+            }
+            connManager.releaseConnection(this, remainingTime, TimeUnit.MILLISECONDS);
+        }
     }
 
     // non-javadoc, see interface ConnectionReleaseTrigger
@@ -379,7 +422,7 @@
         // manager if #abortConnection() is called from the main execution 
         // thread while there is no blocking I/O operation.
         if (executionThread.equals(Thread.currentThread())) {
-            releaseConnection(-1, null);
+            releaseConnection();
         }
     }
 

Modified: httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/client/TestDefaultClientRequestDirector.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/client/TestDefaultClientRequestDirector.java?rev=672367&r1=672366&r2=672367&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/client/TestDefaultClientRequestDirector.java
(original)
+++ httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/client/TestDefaultClientRequestDirector.java
Fri Jun 27 12:49:20 2008
@@ -379,7 +379,7 @@
                         if(!awaitLatch.await(timeout, tunit))
                             throw new ConnectionPoolTimeoutException();
                         
-                        return new ClientConnAdapterMockup();
+                        return new ClientConnAdapterMockup(ConnMan4.this);
                     }
                 };  
             } else {
@@ -452,7 +452,7 @@
                         long timeout, TimeUnit unit)
                         throws InterruptedException,
                         ConnectionPoolTimeoutException {
-                    allocatedConnection = new ClientConnAdapterMockup() {
+                    allocatedConnection = new ClientConnAdapterMockup(ConnMan2.this) {
                         @Override
                         public void open(HttpRoute route, HttpContext context,
                                 HttpParams params) throws IOException {
@@ -535,7 +535,7 @@
                     if(!awaitLatch.await(timeout, tunit))
                         throw new ConnectionPoolTimeoutException();
                     
-                    return new ClientConnAdapterMockup();
+                    return new ClientConnAdapterMockup(ConMan.this);
                 }
             };
         }

Modified: httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/client/TestDefaultConnKeepAliveStrategy.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/client/TestDefaultConnKeepAliveStrategy.java?rev=672367&r1=672366&r2=672367&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/client/TestDefaultConnKeepAliveStrategy.java
(original)
+++ httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/client/TestDefaultConnKeepAliveStrategy.java
Fri Jun 27 12:49:20 2008
@@ -1,7 +1,7 @@
 /*
- * $HeadURL: $
- * $Revision: $
- * $Date: $
+ * $HeadURL$
+ * $Revision$
+ * $Date$
  * ====================================================================
  *
  *  Licensed to the Apache Software Foundation (ASF) under one or more
@@ -115,7 +115,7 @@
         response.addHeader("Keep-Alive", "timeout=300, max=20");
         ConnectionKeepAliveStrategy keepAliveStrat = new DefaultConnectionKeepAliveStrategy();
         long d = keepAliveStrat.getKeepAliveDuration(response, context);
-        assertEquals(300, d);
+        assertEquals(300000, d);
     }
 
 }

Modified: httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/conn/ClientConnAdapterMockup.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/conn/ClientConnAdapterMockup.java?rev=672367&r1=672366&r2=672367&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/conn/ClientConnAdapterMockup.java
(original)
+++ httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/conn/ClientConnAdapterMockup.java
Fri Jun 27 12:49:20 2008
@@ -33,6 +33,7 @@
 import java.io.IOException;
 
 import org.apache.http.HttpHost;
+import org.apache.http.conn.ClientConnectionManager;
 import org.apache.http.conn.routing.HttpRoute;
 import org.apache.http.params.HttpParams;
 import org.apache.http.protocol.HttpContext;
@@ -43,8 +44,8 @@
  */
 public class ClientConnAdapterMockup extends AbstractClientConnAdapter {
 
-    public ClientConnAdapterMockup() {
-        super(null, null);
+    public ClientConnAdapterMockup(ClientConnectionManager mgr) {
+        super(mgr, null);
     }
 
     public void close() {

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=672367&r1=672366&r2=672367&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
Fri Jun 27 12:49:20 2008
@@ -309,7 +309,7 @@
             // expected
         }
         try {
-            mgr.releaseConnection(new ClientConnAdapterMockup(), -1, null);
+            mgr.releaseConnection(new ClientConnAdapterMockup(null), -1, null);
             fail("foreign connection adapter not detected");
         } catch (IllegalArgumentException iax) {
             // expected

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=672367&r1=672366&r2=672367&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
Fri Jun 27 12:49:20 2008
@@ -654,7 +654,7 @@
         }
 
         // return it back to the manager
-        ((AbstractClientConnAdapter) conn).releaseConnection(-1, null);
+        ((AbstractClientConnAdapter) conn).releaseConnection();
         
         // the connection is expected to be released back to the manager
         ManagedClientConnection conn2 = getConnection(mgr, route, 5L, TimeUnit.SECONDS);
@@ -720,7 +720,7 @@
         }
 
         // return it back to the manager
-        ((AbstractClientConnAdapter) conn).releaseConnection(-1, null);
+        ((AbstractClientConnAdapter) conn).releaseConnection();
         
         // the connection is expected to be released back to the manager
         ManagedClientConnection conn2 = getConnection(mgr, route, 5L, TimeUnit.SECONDS);
@@ -791,7 +791,7 @@
         }
 
         // return it back to the manager
-        ((AbstractClientConnAdapter) conn).releaseConnection(-1, null);
+        ((AbstractClientConnAdapter) conn).releaseConnection();
         
         // the connection is expected to be released back to the manager
         ManagedClientConnection conn2 = getConnection(mgr, route, 5L, TimeUnit.SECONDS);
@@ -869,7 +869,7 @@
         }
 
         // return it back to the manager
-        ((AbstractClientConnAdapter) conn).releaseConnection(-1, null);
+        ((AbstractClientConnAdapter) conn).releaseConnection();
         
         // the connection is expected to be released back to the manager
         ManagedClientConnection conn2 = getConnection(mgr, route, 5L, TimeUnit.SECONDS);



Mime
View raw message