hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1154914 [1/2] - in /httpcomponents/httpclient/branches/conn-mgmt-redesign: ./ httpclient/src/examples/org/apache/http/examples/client/ httpclient/src/examples/org/apache/http/examples/conn/ httpclient/src/main/java/org/apache/http/client/m...
Date Mon, 08 Aug 2011 10:51:12 GMT
Author: olegk
Date: Mon Aug  8 10:51:10 2011
New Revision: 1154914

URL: http://svn.apache.org/viewvc?rev=1154914&view=rev
Log:
Redesign of connection management classes based on new pooling components from HttpCore

Removed:
    httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/examples/org/apache/http/examples/conn/ManagerConnectDirect.java
    httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/examples/org/apache/http/examples/conn/ManagerConnectProxy.java
Modified:
    httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/examples/org/apache/http/examples/client/ClientEvictExpiredConnections.java
    httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/examples/org/apache/http/examples/client/ClientMultiThreadedExecution.java
    httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/client/methods/AbortableHttpRequest.java
    httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/conn/routing/HttpRoute.java
    httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/AbstractClientConnAdapter.java
    httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/AbstractPoolEntry.java
    httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/AbstractPooledConnAdapter.java
    httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/DefaultClientConnection.java
    httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/DefaultResponseParser.java
    httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/SingleClientConnManager.java
    httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/AbstractConnPool.java
    httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/BasicPoolEntry.java
    httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/BasicPoolEntryRef.java
    httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/BasicPooledConnAdapter.java
    httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/ConnPoolByRoute.java
    httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/PoolEntryRequest.java
    httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/RouteSpecificPool.java
    httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/ThreadSafeClientConnManager.java
    httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/WaitingThread.java
    httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/WaitingThreadAborter.java
    httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/client/utils/TestURLEncodedUtils.java
    httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/conn/TestConnectionAutoRelease.java
    httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/conn/TestConnectionReuse.java
    httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/impl/client/TestContentCodings.java
    httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/impl/client/TestDefaultClientRequestDirector.java
    httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/impl/client/TestRequestRetryHandler.java
    httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/impl/client/TestStatefulConnManagement.java
    httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/impl/conn/ExecReqThread.java
    httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/impl/conn/GetConnThread.java
    httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/impl/conn/TestDefaultResponseParser.java
    httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/impl/conn/TestIdleConnectionEviction.java
    httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/impl/conn/TestSCMWithServer.java
    httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/impl/conn/TestTSCCMNoServer.java
    httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/impl/conn/TestTSCCMWithServer.java
    httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/impl/conn/tsccm/AwaitThread.java
    httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/impl/conn/tsccm/TestConnPoolByRoute.java
    httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/impl/conn/tsccm/TestSpuriousWakeup.java
    httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/impl/conn/tsccm/TestWaitingThread.java
    httpcomponents/httpclient/branches/conn-mgmt-redesign/pom.xml

Modified: httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/examples/org/apache/http/examples/client/ClientEvictExpiredConnections.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/examples/org/apache/http/examples/client/ClientEvictExpiredConnections.java?rev=1154914&r1=1154913&r2=1154914&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/examples/org/apache/http/examples/client/ClientEvictExpiredConnections.java (original)
+++ httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/examples/org/apache/http/examples/client/ClientEvictExpiredConnections.java Mon Aug  8 10:51:10 2011
@@ -34,7 +34,7 @@ import org.apache.http.client.HttpClient
 import org.apache.http.client.methods.HttpGet;
 import org.apache.http.conn.ClientConnectionManager;
 import org.apache.http.impl.client.DefaultHttpClient;
-import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
+import org.apache.http.impl.conn.PoolingClientConnectionManager;
 import org.apache.http.util.EntityUtils;
 
 /**
@@ -44,7 +44,7 @@ import org.apache.http.util.EntityUtils;
 public class ClientEvictExpiredConnections {
 
     public static void main(String[] args) throws Exception {
-        ThreadSafeClientConnManager cm = new ThreadSafeClientConnManager();
+        PoolingClientConnectionManager cm = new PoolingClientConnectionManager();
         cm.setMaxTotal(100);
 
         HttpClient httpclient = new DefaultHttpClient(cm);

Modified: httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/examples/org/apache/http/examples/client/ClientMultiThreadedExecution.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/examples/org/apache/http/examples/client/ClientMultiThreadedExecution.java?rev=1154914&r1=1154913&r2=1154914&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/examples/org/apache/http/examples/client/ClientMultiThreadedExecution.java (original)
+++ httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/examples/org/apache/http/examples/client/ClientMultiThreadedExecution.java Mon Aug  8 10:51:10 2011
@@ -31,7 +31,7 @@ import org.apache.http.HttpResponse;
 import org.apache.http.client.HttpClient;
 import org.apache.http.client.methods.HttpGet;
 import org.apache.http.impl.client.DefaultHttpClient;
-import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
+import org.apache.http.impl.conn.PoolingClientConnectionManager;
 import org.apache.http.protocol.BasicHttpContext;
 import org.apache.http.protocol.HttpContext;
 import org.apache.http.util.EntityUtils;
@@ -46,7 +46,7 @@ public class ClientMultiThreadedExecutio
         // Create an HttpClient with the ThreadSafeClientConnManager.
         // This connection manager must be used if more than one thread will
         // be using the HttpClient.
-        ThreadSafeClientConnManager cm = new ThreadSafeClientConnManager();
+        PoolingClientConnectionManager cm = new PoolingClientConnectionManager();
         cm.setMaxTotal(100);
 
         HttpClient httpclient = new DefaultHttpClient(cm);

Modified: httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/client/methods/AbortableHttpRequest.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/client/methods/AbortableHttpRequest.java?rev=1154914&r1=1154913&r2=1154914&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/client/methods/AbortableHttpRequest.java (original)
+++ httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/client/methods/AbortableHttpRequest.java Mon Aug  8 10:51:10 2011
@@ -34,7 +34,6 @@ import org.apache.http.conn.ClientConnec
 import org.apache.http.conn.ClientConnectionRequest;
 import org.apache.http.conn.ConnectionReleaseTrigger;
 import org.apache.http.conn.ManagedClientConnection;
-import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
 
 /**
  * Interface representing an HTTP request that can be aborted by shutting
@@ -52,7 +51,6 @@ public interface AbortableHttpRequest {
      * If the request is already aborted, throws an {@link IOException}.
      *
      * @see ClientConnectionManager
-     * @see ThreadSafeClientConnManager
      */
     void setConnectionRequest(ClientConnectionRequest connRequest) throws IOException;
 

Modified: httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/conn/routing/HttpRoute.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/conn/routing/HttpRoute.java?rev=1154914&r1=1154913&r2=1154914&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/conn/routing/HttpRoute.java (original)
+++ httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/conn/routing/HttpRoute.java Mon Aug  8 10:51:10 2011
@@ -334,7 +334,7 @@ public final class HttpRoute implements 
         if (this == obj) return true;
         if (obj instanceof HttpRoute) {
             HttpRoute that = (HttpRoute) obj;
-            return 
+            return
                 // Do the cheapest tests first
                 (this.secure    == that.secure) &&
                 (this.tunnelled == that.tunnelled) &&
@@ -376,8 +376,6 @@ public final class HttpRoute implements 
     @Override
     public final String toString() {
         StringBuilder cab = new StringBuilder(50 + getHopCount()*30);
-
-        cab.append("HttpRoute[");
         if (this.localAddress != null) {
             cab.append(this.localAddress);
             cab.append("->");
@@ -395,8 +393,6 @@ public final class HttpRoute implements 
             cab.append("->");
         }
         cab.append(this.targetHost);
-        cab.append(']');
-
         return cab.toString();
     }
 

Modified: httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/AbstractClientConnAdapter.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/AbstractClientConnAdapter.java?rev=1154914&r1=1154913&r2=1154914&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/AbstractClientConnAdapter.java (original)
+++ httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/AbstractClientConnAdapter.java Mon Aug  8 10:51:10 2011
@@ -40,6 +40,7 @@ import org.apache.http.HttpRequest;
 import org.apache.http.HttpEntityEnclosingRequest;
 import org.apache.http.HttpResponse;
 import org.apache.http.HttpConnectionMetrics;
+import org.apache.http.annotation.NotThreadSafe;
 import org.apache.http.conn.OperatedClientConnection;
 import org.apache.http.conn.ManagedClientConnection;
 import org.apache.http.conn.ClientConnectionManager;
@@ -66,8 +67,8 @@ import org.apache.http.protocol.HttpCont
  *
  * @since 4.0
  */
-public abstract class AbstractClientConnAdapter
-                            implements ManagedClientConnection, HttpContext {
+@NotThreadSafe
+public abstract class AbstractClientConnAdapter implements ManagedClientConnection, HttpContext {
 
     /**
      * The connection manager, if any.

Modified: httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/AbstractPoolEntry.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/AbstractPoolEntry.java?rev=1154914&r1=1154913&r2=1154914&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/AbstractPoolEntry.java (original)
+++ httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/AbstractPoolEntry.java Mon Aug  8 10:51:10 2011
@@ -31,7 +31,6 @@ import java.io.IOException;
 import org.apache.http.HttpHost;
 import org.apache.http.params.HttpParams;
 import org.apache.http.protocol.HttpContext;
-import org.apache.http.annotation.NotThreadSafe;
 import org.apache.http.conn.routing.HttpRoute;
 import org.apache.http.conn.routing.RouteTracker;
 import org.apache.http.conn.ClientConnectionOperator;
@@ -52,8 +51,10 @@ import org.apache.http.conn.OperatedClie
  * underlying connection and the established route.
  *
  * @since 4.0
+ *
+ * @deprecated do not use
  */
-@NotThreadSafe
+@Deprecated
 public abstract class AbstractPoolEntry {
 
     /** The connection operator. */

Modified: httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/AbstractPooledConnAdapter.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/AbstractPooledConnAdapter.java?rev=1154914&r1=1154913&r2=1154914&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/AbstractPooledConnAdapter.java (original)
+++ httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/AbstractPooledConnAdapter.java Mon Aug  8 10:51:10 2011
@@ -46,7 +46,10 @@ import org.apache.http.conn.OperatedClie
  * respective method of the wrapped connection.
  *
  * @since 4.0
+ *
+ * @deprecated do not use
  */
+@Deprecated
 public abstract class AbstractPooledConnAdapter extends AbstractClientConnAdapter {
 
     /** The wrapped pool entry. */

Modified: httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/DefaultClientConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/DefaultClientConnection.java?rev=1154914&r1=1154913&r2=1154914&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/DefaultClientConnection.java (original)
+++ httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/DefaultClientConnection.java Mon Aug  8 10:51:10 2011
@@ -149,7 +149,9 @@ public class DefaultClientConnection ext
         shutdown = true;
         try {
             super.shutdown();
-            log.debug("Connection shut down");
+            if (log.isDebugEnabled()) {
+                log.debug("Connection " + this + " shut down");
+            }
             Socket sock = this.socket; // copy volatile attribute
             if (sock != null)
                 sock.close();
@@ -162,7 +164,9 @@ public class DefaultClientConnection ext
     public void close() throws IOException {
         try {
             super.close();
-            log.debug("Connection closed");
+            if (log.isDebugEnabled()) {
+                log.debug("Connection " + this + " closed");
+            }
         } catch (IOException ex) {
             log.debug("I/O error closing connection", ex);
         }
@@ -211,7 +215,7 @@ public class DefaultClientConnection ext
     }
 
     @Override
-    protected HttpMessageParser createResponseParser(
+    protected HttpMessageParser<HttpResponse> createResponseParser(
             final SessionInputBuffer buffer,
             final HttpResponseFactory responseFactory,
             final HttpParams params) {

Modified: httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/DefaultResponseParser.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/DefaultResponseParser.java?rev=1154914&r1=1154913&r2=1154914&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/DefaultResponseParser.java (original)
+++ httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/DefaultResponseParser.java Mon Aug  8 10:51:10 2011
@@ -34,7 +34,7 @@ import org.apache.http.annotation.Thread
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.http.HttpException;
-import org.apache.http.HttpMessage;
+import org.apache.http.HttpResponse;
 import org.apache.http.HttpResponseFactory;
 import org.apache.http.NoHttpResponseException;
 import org.apache.http.ProtocolException;
@@ -60,7 +60,7 @@ import org.apache.http.util.CharArrayBuf
  * @since 4.0
  */
 @ThreadSafe // no public methods
-public class DefaultResponseParser extends AbstractMessageParser {
+public class DefaultResponseParser extends AbstractMessageParser<HttpResponse> {
 
     private final Log log = LogFactory.getLog(getClass());
 
@@ -94,7 +94,7 @@ public class DefaultResponseParser exten
     }
 
     @Override
-    protected HttpMessage parseHead(
+    protected HttpResponse parseHead(
             final SessionInputBuffer sessionBuffer) throws IOException, HttpException {
         //read out the HTTP status string
         int count = 0;

Modified: httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/SingleClientConnManager.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/SingleClientConnManager.java?rev=1154914&r1=1154913&r2=1154914&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/SingleClientConnManager.java (original)
+++ httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/SingleClientConnManager.java Mon Aug  8 10:51:10 2011
@@ -57,8 +57,11 @@ import org.apache.http.params.HttpParams
  * already been allocated {@link IllegalStateException} is thrown.
  *
  * @since 4.0
+ *
+ * @deprecated use {@link SingleConnectionManager}
  */
 @ThreadSafe
+@Deprecated
 public class SingleClientConnManager implements ClientConnectionManager {
 
     private final Log log = LogFactory.getLog(getClass());

Modified: httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/AbstractConnPool.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/AbstractConnPool.java?rev=1154914&r1=1154913&r2=1154914&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/AbstractConnPool.java (original)
+++ httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/AbstractConnPool.java Mon Aug  8 10:51:10 2011
@@ -53,6 +53,8 @@ import org.apache.http.impl.conn.IdleCon
  * Don't use <code>synchronized</code> for that purpose!
  *
  * @since 4.0
+ *
+ * @deprecated use {@link org.apache.http.pool.AbstractConnPool}
  */
 
 @Deprecated

Modified: httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/BasicPoolEntry.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/BasicPoolEntry.java?rev=1154914&r1=1154913&r2=1154914&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/BasicPoolEntry.java (original)
+++ httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/BasicPoolEntry.java Mon Aug  8 10:51:10 2011
@@ -29,7 +29,6 @@ package org.apache.http.impl.conn.tsccm;
 import java.lang.ref.ReferenceQueue;
 import java.util.concurrent.TimeUnit;
 
-import org.apache.http.annotation.NotThreadSafe;
 import org.apache.http.conn.OperatedClientConnection;
 import org.apache.http.conn.ClientConnectionOperator;
 import org.apache.http.conn.routing.HttpRoute;
@@ -39,8 +38,10 @@ import org.apache.http.impl.conn.Abstrac
  * Basic implementation of a connection pool entry.
  *
  * @since 4.0
+ *
+ * @deprecated use {@link org.apache.http.pool.PoolEntry}
  */
-@NotThreadSafe
+@Deprecated
 public class BasicPoolEntry extends AbstractPoolEntry {
 
     private final long created;

Modified: httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/BasicPoolEntryRef.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/BasicPoolEntryRef.java?rev=1154914&r1=1154913&r2=1154914&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/BasicPoolEntryRef.java (original)
+++ httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/BasicPoolEntryRef.java Mon Aug  8 10:51:10 2011
@@ -26,24 +26,21 @@
 
 package org.apache.http.impl.conn.tsccm;
 
-
 import java.lang.ref.WeakReference;
 import java.lang.ref.ReferenceQueue;
 
-import org.apache.http.annotation.Immutable;
-
 import org.apache.http.conn.routing.HttpRoute;
 
-
-
 /**
  * A weak reference to a {@link BasicPoolEntry BasicPoolEntry}.
  * This reference explicitly keeps the planned route, so the connection
  * can be reclaimed if it is lost to garbage collection.
  *
  * @since 4.0
+ *
+ * @deprecated do not use
  */
-@Immutable
+@Deprecated
 public class BasicPoolEntryRef extends WeakReference<BasicPoolEntry> {
 
     /** The planned route of the entry. */

Modified: httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/BasicPooledConnAdapter.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/BasicPooledConnAdapter.java?rev=1154914&r1=1154913&r2=1154914&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/BasicPooledConnAdapter.java (original)
+++ httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/BasicPooledConnAdapter.java Mon Aug  8 10:51:10 2011
@@ -36,7 +36,10 @@ import org.apache.http.impl.conn.Abstrac
  * can be {@link #detach detach}ed to prevent further use on release.
  *
  * @since 4.0
+ *
+ * @deprecated do not use
  */
+@Deprecated
 public class BasicPooledConnAdapter extends AbstractPooledConnAdapter {
 
     /**

Modified: httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/ConnPoolByRoute.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/ConnPoolByRoute.java?rev=1154914&r1=1154913&r2=1154914&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/ConnPoolByRoute.java (original)
+++ httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/ConnPoolByRoute.java Mon Aug  8 10:51:10 2011
@@ -40,7 +40,6 @@ import java.util.concurrent.TimeUnit;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.http.annotation.ThreadSafe;
 import org.apache.http.conn.routing.HttpRoute;
 import org.apache.http.conn.ClientConnectionOperator;
 import org.apache.http.conn.ConnectionPoolTimeoutException;
@@ -63,10 +62,11 @@ import org.apache.http.params.HttpParams
  * not via <code>synchronized</code> methods.
  *
  * @since 4.0
+ *
+ * @deprecated use {@link org.apache.http.pool.AbstractConnPool}
  */
-@ThreadSafe
-@SuppressWarnings("deprecation")
-public class ConnPoolByRoute extends AbstractConnPool { //TODO: remove dependency on AbstractConnPool
+@Deprecated
+public class ConnPoolByRoute extends AbstractConnPool {
 
     private final Log log = LogFactory.getLog(getClass());
 

Modified: httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/PoolEntryRequest.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/PoolEntryRequest.java?rev=1154914&r1=1154913&r2=1154914&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/PoolEntryRequest.java (original)
+++ httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/PoolEntryRequest.java Mon Aug  8 10:51:10 2011
@@ -26,6 +26,7 @@
 
 package org.apache.http.impl.conn.tsccm;
 
+import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.http.conn.ConnectionPoolTimeoutException;
@@ -34,7 +35,10 @@ import org.apache.http.conn.ConnectionPo
  * Encapsulates a request for a {@link BasicPoolEntry}.
  *
  * @since 4.0
+ *
+ * @deprecated use {@link Future}
  */
+@Deprecated
 public interface PoolEntryRequest {
 
     /**

Modified: httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/RouteSpecificPool.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/RouteSpecificPool.java?rev=1154914&r1=1154913&r2=1154914&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/RouteSpecificPool.java (original)
+++ httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/RouteSpecificPool.java Mon Aug  8 10:51:10 2011
@@ -31,8 +31,6 @@ import java.util.ListIterator;
 import java.util.Queue;
 import java.util.LinkedList;
 
-import org.apache.http.annotation.NotThreadSafe;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.http.conn.OperatedClientConnection;
@@ -47,8 +45,10 @@ import org.apache.http.util.LangUtils;
  * containing pool takes care of synchronization.
  *
  * @since 4.0
+ *
+ * @deprecated use {@link org.apache.http.pool.AbstractConnPool}
  */
-@NotThreadSafe // e.g. numEntries, freeEntries,
+@Deprecated
 public class RouteSpecificPool {
 
     private final Log log = LogFactory.getLog(getClass());

Modified: httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/ThreadSafeClientConnManager.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/ThreadSafeClientConnManager.java?rev=1154914&r1=1154913&r2=1154914&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/ThreadSafeClientConnManager.java (original)
+++ httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/ThreadSafeClientConnManager.java Mon Aug  8 10:51:10 2011
@@ -43,6 +43,7 @@ import org.apache.http.conn.ManagedClien
 import org.apache.http.conn.OperatedClientConnection;
 import org.apache.http.params.HttpParams;
 import org.apache.http.impl.conn.DefaultClientConnectionOperator;
+import org.apache.http.impl.conn.PoolingClientConnectionManager;
 import org.apache.http.impl.conn.SchemeRegistryFactory;
 
 /**
@@ -62,8 +63,11 @@ import org.apache.http.impl.conn.SchemeR
  * can be adjusted using HTTP parameters.
  *
  * @since 4.0
+ *
+ * @deprecated use {@link PoolingClientConnectionManager}
  */
 @ThreadSafe
+@Deprecated
 public class ThreadSafeClientConnManager implements ClientConnectionManager {
 
     private final Log log;
@@ -135,7 +139,7 @@ public class ThreadSafeClientConnManager
         this.connPerRoute = connPerRoute;
         this.connOperator = createConnectionOperator(schreg);
         this.pool = createConnectionPool(connTTL, connTTLTimeUnit) ;
-        this.connectionPool = this.pool;        
+        this.connectionPool = this.pool;
     }
 
     /**

Modified: httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/WaitingThread.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/WaitingThread.java?rev=1154914&r1=1154913&r2=1154914&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/WaitingThread.java (original)
+++ httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/WaitingThread.java Mon Aug  8 10:51:10 2011
@@ -30,8 +30,6 @@ package org.apache.http.impl.conn.tsccm;
 import java.util.Date;
 import java.util.concurrent.locks.Condition;
 
-import org.apache.http.annotation.NotThreadSafe;
-
 /**
  * Represents a thread waiting for a connection.
  * This class implements throwaway objects. It is instantiated whenever
@@ -44,8 +42,10 @@ import org.apache.http.annotation.NotThr
  *
  *
  * @since 4.0
+ *
+ * @deprecated do not use
  */
-@NotThreadSafe
+@Deprecated
 public class WaitingThread {
 
     /** The condition on which the thread is waiting. */

Modified: httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/WaitingThreadAborter.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/WaitingThreadAborter.java?rev=1154914&r1=1154913&r2=1154914&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/WaitingThreadAborter.java (original)
+++ httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/WaitingThreadAborter.java Mon Aug  8 10:51:10 2011
@@ -26,17 +26,16 @@
 
 package org.apache.http.impl.conn.tsccm;
 
-import org.apache.http.annotation.NotThreadSafe;
-
-// TODO - only called from ConnPoolByRoute currently; consider adding it as nested class
 /**
  * A simple class that can interrupt a {@link WaitingThread}.
  *
  * Must be called with the pool lock held.
  *
  * @since 4.0
+ *
+ * @deprecated do not use
  */
-@NotThreadSafe
+@Deprecated
 public class WaitingThreadAborter {
 
     private WaitingThread waitingThread;

Modified: httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/client/utils/TestURLEncodedUtils.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/client/utils/TestURLEncodedUtils.java?rev=1154914&r1=1154913&r2=1154914&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/client/utils/TestURLEncodedUtils.java (original)
+++ httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/client/utils/TestURLEncodedUtils.java Mon Aug  8 10:51:10 2011
@@ -89,7 +89,7 @@ public class TestURLEncodedUtils {
 
     @Test
     public void testParseEntity () throws Exception {
-        final StringEntity entity = new StringEntity("Name1=Value1", null);
+        final StringEntity entity = new StringEntity("Name1=Value1");
 
         entity.setContentType(URLEncodedUtils.CONTENT_TYPE);
         final List <NameValuePair> result = URLEncodedUtils.parse(entity);
@@ -142,7 +142,7 @@ public class TestURLEncodedUtils {
 
     @Test
     public void testIsEncoded () throws Exception {
-        final StringEntity entity = new StringEntity("...", null);
+        final StringEntity entity = new StringEntity("...");
 
         entity.setContentType(URLEncodedUtils.CONTENT_TYPE);
         Assert.assertTrue(URLEncodedUtils.isEncoded(entity));

Modified: httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/conn/TestConnectionAutoRelease.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/conn/TestConnectionAutoRelease.java?rev=1154914&r1=1154913&r2=1154914&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/conn/TestConnectionAutoRelease.java (original)
+++ httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/conn/TestConnectionAutoRelease.java Mon Aug  8 10:51:10 2011
@@ -40,12 +40,12 @@ import org.apache.http.HttpResponse;
 import org.apache.http.MalformedChunkCodingException;
 import org.apache.http.client.methods.HttpGet;
 import org.apache.http.conn.routing.HttpRoute;
-import org.apache.http.conn.scheme.SchemeRegistry;
 import org.apache.http.entity.BasicHttpEntity;
 import org.apache.http.impl.DefaultHttpServerConnection;
 import org.apache.http.impl.client.DefaultHttpClient;
-import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
+import org.apache.http.impl.conn.PoolingClientConnectionManager;
 import org.apache.http.localserver.ServerTestBase;
+import org.apache.http.pool.PoolStats;
 import org.apache.http.protocol.ExecutionContext;
 import org.apache.http.protocol.HttpContext;
 import org.apache.http.protocol.HttpRequestHandler;
@@ -55,20 +55,15 @@ import org.junit.Test;
 
 public class TestConnectionAutoRelease extends ServerTestBase {
 
-    private ThreadSafeClientConnManager createTSCCM(SchemeRegistry schreg) {
-        if (schreg == null)
-            schreg = supportedSchemes;
-        return new ThreadSafeClientConnManager(schreg);
-    }
-
     @Test
     public void testReleaseOnEntityConsumeContent() throws Exception {
-        ThreadSafeClientConnManager mgr = createTSCCM(null);
+        PoolingClientConnectionManager mgr = new PoolingClientConnectionManager();
         mgr.setDefaultMaxPerRoute(1);
         mgr.setMaxTotal(1);
 
         // Zero connections in the pool
-        Assert.assertEquals(0, mgr.getConnectionsInPool());
+        PoolStats stats = mgr.getTotalStats();
+        Assert.assertEquals(0, stats.getAvailable());
 
         DefaultHttpClient client = new DefaultHttpClient(mgr);
 
@@ -90,7 +85,8 @@ public class TestConnectionAutoRelease e
         EntityUtils.consume(e);
 
         // Expect one connection in the pool
-        Assert.assertEquals(1, mgr.getConnectionsInPool());
+        stats = mgr.getTotalStats();
+        Assert.assertEquals(1, stats.getAvailable());
 
         // Make sure one connection is available
         connreq = mgr.requestConnection(new HttpRoute(target), null);
@@ -103,12 +99,13 @@ public class TestConnectionAutoRelease e
 
     @Test
     public void testReleaseOnEntityWriteTo() throws Exception {
-        ThreadSafeClientConnManager mgr = createTSCCM(null);
+        PoolingClientConnectionManager mgr = new PoolingClientConnectionManager();
         mgr.setDefaultMaxPerRoute(1);
         mgr.setMaxTotal(1);
 
         // Zero connections in the pool
-        Assert.assertEquals(0, mgr.getConnectionsInPool());
+        PoolStats stats = mgr.getTotalStats();
+        Assert.assertEquals(0, stats.getAvailable());
 
         DefaultHttpClient client = new DefaultHttpClient(mgr);
 
@@ -131,7 +128,8 @@ public class TestConnectionAutoRelease e
         e.writeTo(outsteam);
 
         // Expect one connection in the pool
-        Assert.assertEquals(1, mgr.getConnectionsInPool());
+        stats = mgr.getTotalStats();
+        Assert.assertEquals(1, stats.getAvailable());
 
         // Make sure one connection is available
         connreq = mgr.requestConnection(new HttpRoute(target), null);
@@ -144,12 +142,13 @@ public class TestConnectionAutoRelease e
 
     @Test
     public void testReleaseOnAbort() throws Exception {
-        ThreadSafeClientConnManager mgr = createTSCCM(null);
+        PoolingClientConnectionManager mgr = new PoolingClientConnectionManager();
         mgr.setDefaultMaxPerRoute(1);
         mgr.setMaxTotal(1);
 
         // Zero connections in the pool
-        Assert.assertEquals(0, mgr.getConnectionsInPool());
+        PoolStats stats = mgr.getTotalStats();
+        Assert.assertEquals(0, stats.getAvailable());
 
         DefaultHttpClient client = new DefaultHttpClient(mgr);
 
@@ -171,7 +170,7 @@ public class TestConnectionAutoRelease e
         httpget.abort();
 
         // Expect zero connections in the pool
-        Assert.assertEquals(0, mgr.getConnectionsInPool());
+        Assert.assertEquals(0, mgr.getTotalStats().getAvailable());
 
         // Make sure one connection is available
         connreq = mgr.requestConnection(new HttpRoute(target), null);
@@ -217,12 +216,12 @@ public class TestConnectionAutoRelease e
 
         });
 
-        ThreadSafeClientConnManager mgr = createTSCCM(null);
+        PoolingClientConnectionManager mgr = new PoolingClientConnectionManager();
         mgr.setDefaultMaxPerRoute(1);
         mgr.setMaxTotal(1);
 
         // Zero connections in the pool
-        Assert.assertEquals(0, mgr.getConnectionsInPool());
+        Assert.assertEquals(0, mgr.getTotalStats().getAvailable());
 
         DefaultHttpClient client = new DefaultHttpClient(mgr);
 
@@ -250,7 +249,7 @@ public class TestConnectionAutoRelease e
         }
 
         // Expect zero connections in the pool
-        Assert.assertEquals(0, mgr.getConnectionsInPool());
+        Assert.assertEquals(0, mgr.getTotalStats().getAvailable());
 
         // Make sure one connection is available
         connreq = mgr.requestConnection(new HttpRoute(target), null);

Modified: httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/conn/TestConnectionReuse.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/conn/TestConnectionReuse.java?rev=1154914&r1=1154913&r2=1154914&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/conn/TestConnectionReuse.java (original)
+++ httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/conn/TestConnectionReuse.java Mon Aug  8 10:51:10 2011
@@ -44,7 +44,7 @@ import org.apache.http.conn.scheme.Schem
 import org.apache.http.conn.scheme.SchemeRegistry;
 import org.apache.http.conn.scheme.SchemeSocketFactory;
 import org.apache.http.impl.client.DefaultHttpClient;
-import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
+import org.apache.http.impl.conn.PoolingClientConnectionManager;
 import org.apache.http.localserver.LocalTestServer;
 import org.apache.http.localserver.RandomHandler;
 import org.apache.http.params.BasicHttpParams;
@@ -99,7 +99,7 @@ public class TestConnectionReuse {
         SchemeSocketFactory sf = PlainSocketFactory.getSocketFactory();
         supportedSchemes.register(new Scheme("http", 80, sf));
 
-        ThreadSafeClientConnManager mgr = new ThreadSafeClientConnManager(supportedSchemes);
+        PoolingClientConnectionManager mgr = new PoolingClientConnectionManager(supportedSchemes);
         mgr.setMaxTotal(5);
         mgr.setDefaultMaxPerRoute(5);
 
@@ -130,7 +130,7 @@ public class TestConnectionReuse {
         }
 
         // Expect some connection in the pool
-        Assert.assertTrue(mgr.getConnectionsInPool() > 0);
+        Assert.assertTrue(mgr.getTotalStats().getAvailable() > 0);
 
         mgr.shutdown();
     }
@@ -170,7 +170,7 @@ public class TestConnectionReuse {
         SchemeSocketFactory sf = PlainSocketFactory.getSocketFactory();
         supportedSchemes.register(new Scheme("http", 80, sf));
 
-        ThreadSafeClientConnManager mgr = new ThreadSafeClientConnManager(supportedSchemes);
+        PoolingClientConnectionManager mgr = new PoolingClientConnectionManager(supportedSchemes);
         mgr.setMaxTotal(5);
         mgr.setDefaultMaxPerRoute(5);
 
@@ -201,7 +201,7 @@ public class TestConnectionReuse {
         }
 
         // Expect zero connections in the pool
-        Assert.assertEquals(0, mgr.getConnectionsInPool());
+        Assert.assertEquals(0, mgr.getTotalStats().getAvailable());
 
         mgr.shutdown();
     }
@@ -231,7 +231,7 @@ public class TestConnectionReuse {
         SchemeSocketFactory sf = PlainSocketFactory.getSocketFactory();
         supportedSchemes.register(new Scheme("http", 80, sf));
 
-        ThreadSafeClientConnManager mgr = new ThreadSafeClientConnManager(supportedSchemes);
+        PoolingClientConnectionManager mgr = new PoolingClientConnectionManager(supportedSchemes);
         mgr.setMaxTotal(5);
         mgr.setDefaultMaxPerRoute(5);
 
@@ -262,7 +262,7 @@ public class TestConnectionReuse {
         }
 
         // Expect zero connections in the pool
-        Assert.assertEquals(0, mgr.getConnectionsInPool());
+        Assert.assertEquals(0, mgr.getTotalStats().getAvailable());
 
         mgr.shutdown();
     }
@@ -293,7 +293,7 @@ public class TestConnectionReuse {
         SchemeSocketFactory sf = PlainSocketFactory.getSocketFactory();
         supportedSchemes.register(new Scheme("http", 80, sf));
 
-        ThreadSafeClientConnManager mgr = new ThreadSafeClientConnManager(supportedSchemes);
+        PoolingClientConnectionManager mgr = new PoolingClientConnectionManager(supportedSchemes);
         mgr.setMaxTotal(1);
         mgr.setDefaultMaxPerRoute(1);
 
@@ -303,13 +303,13 @@ public class TestConnectionReuse {
         HttpResponse response = client.execute(target, new HttpGet("/random/2000"));
         EntityUtils.consume(response.getEntity());
 
-        Assert.assertEquals(1, mgr.getConnectionsInPool());
+        Assert.assertEquals(1, mgr.getTotalStats().getAvailable());
         Assert.assertEquals(1, localServer.getAcceptedConnectionCount());
 
         response = client.execute(target, new HttpGet("/random/2000"));
         EntityUtils.consume(response.getEntity());
 
-        Assert.assertEquals(1, mgr.getConnectionsInPool());
+        Assert.assertEquals(1, mgr.getTotalStats().getAvailable());
         Assert.assertEquals(1, localServer.getAcceptedConnectionCount());
 
         // Now sleep for 1.1 seconds and let the timeout do its work
@@ -317,7 +317,7 @@ public class TestConnectionReuse {
         response = client.execute(target, new HttpGet("/random/2000"));
         EntityUtils.consume(response.getEntity());
 
-        Assert.assertEquals(1, mgr.getConnectionsInPool());
+        Assert.assertEquals(1, mgr.getTotalStats().getAvailable());
         Assert.assertEquals(2, localServer.getAcceptedConnectionCount());
 
         // Do another request just under the 1 second limit & make
@@ -326,7 +326,7 @@ public class TestConnectionReuse {
         response = client.execute(target, new HttpGet("/random/2000"));
         EntityUtils.consume(response.getEntity());
 
-        Assert.assertEquals(1, mgr.getConnectionsInPool());
+        Assert.assertEquals(1, mgr.getTotalStats().getAvailable());
         Assert.assertEquals(2, localServer.getAcceptedConnectionCount());
 
 

Modified: httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/impl/client/TestContentCodings.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/impl/client/TestContentCodings.java?rev=1154914&r1=1154913&r2=1154914&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/impl/client/TestContentCodings.java (original)
+++ httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/impl/client/TestContentCodings.java Mon Aug  8 10:51:10 2011
@@ -55,7 +55,7 @@ import org.apache.http.conn.scheme.Schem
 import org.apache.http.conn.scheme.SchemeRegistry;
 import org.apache.http.entity.InputStreamEntity;
 import org.apache.http.entity.StringEntity;
-import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
+import org.apache.http.impl.conn.PoolingClientConnectionManager;
 import org.apache.http.localserver.ServerTestBase;
 import org.apache.http.protocol.HttpContext;
 import org.apache.http.protocol.HttpRequestHandler;
@@ -188,7 +188,7 @@ public class TestContentCodings extends 
         SchemeRegistry schemeRegistry = new SchemeRegistry();
         schemeRegistry.register(new Scheme("http", 80, PlainSocketFactory.getSocketFactory()));
 
-        ThreadSafeClientConnManager cm = new ThreadSafeClientConnManager(schemeRegistry);
+        PoolingClientConnectionManager cm = new PoolingClientConnectionManager(schemeRegistry);
         cm.setMaxTotal(clients);
 
         final HttpClient httpClient = new DefaultHttpClient(cm);

Modified: httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/impl/client/TestDefaultClientRequestDirector.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/impl/client/TestDefaultClientRequestDirector.java?rev=1154914&r1=1154913&r2=1154914&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/impl/client/TestDefaultClientRequestDirector.java (original)
+++ httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/impl/client/TestDefaultClientRequestDirector.java Mon Aug  8 10:51:10 2011
@@ -60,8 +60,7 @@ import org.apache.http.conn.scheme.Schem
 import org.apache.http.entity.InputStreamEntity;
 import org.apache.http.entity.StringEntity;
 import org.apache.http.impl.conn.ClientConnAdapterMockup;
-import org.apache.http.impl.conn.SingleClientConnManager;
-import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
+import org.apache.http.impl.conn.PoolingClientConnectionManager;
 import org.apache.http.localserver.BasicServerTestBase;
 import org.apache.http.localserver.LocalTestServer;
 import org.apache.http.message.BasicHeader;
@@ -141,7 +140,7 @@ public class TestDefaultClientRequestDir
         SchemeRegistry registry = new SchemeRegistry();
         registry.register(new Scheme("http", 80, PlainSocketFactory.getSocketFactory()));
 
-        SingleClientConnManager conMan = new SingleClientConnManager(registry);
+        PoolingClientConnectionManager conMan = new PoolingClientConnectionManager(registry);
         final AtomicReference<Throwable> throwableRef = new AtomicReference<Throwable>();
         final CountDownLatch getLatch = new CountDownLatch(1);
         final DefaultHttpClient client = new DefaultHttpClient(conMan, new BasicHttpParams());
@@ -182,7 +181,7 @@ public class TestDefaultClientRequestDir
         SchemeRegistry registry = new SchemeRegistry();
         registry.register(new Scheme("http", 80, PlainSocketFactory.getSocketFactory()));
 
-        SingleClientConnManager conMan = new SingleClientConnManager(registry);
+        PoolingClientConnectionManager conMan = new PoolingClientConnectionManager(registry);
         final AtomicReference<Throwable> throwableRef = new AtomicReference<Throwable>();
         final CountDownLatch getLatch = new CountDownLatch(1);
         final CountDownLatch startLatch = new CountDownLatch(1);
@@ -283,35 +282,6 @@ public class TestDefaultClientRequestDir
         Assert.assertSame(conMan.allocatedConnection, conMan.releasedConnection);
     }
 
-    @Test
-    public void testRequestFailureReleasesConnection() throws Exception {
-        this.localServer.register("*", new ThrowingService());
-
-        SchemeRegistry registry = new SchemeRegistry();
-        registry.register(new Scheme("http", 80, PlainSocketFactory.getSocketFactory()));
-
-        ConnMan3 conMan = new ConnMan3(registry);
-        DefaultHttpClient client = new DefaultHttpClient(conMan, new BasicHttpParams());
-        HttpGet httpget = new HttpGet("/a");
-
-        try {
-            client.execute(getServerHttp(), httpget);
-            Assert.fail("expected IOException");
-        } catch (IOException expected) {}
-
-        Assert.assertNotNull(conMan.allocatedConnection);
-        Assert.assertSame(conMan.allocatedConnection, conMan.releasedConnection);
-    }
-
-    private static class ThrowingService implements HttpRequestHandler {
-        public void handle(
-                final HttpRequest request,
-                final HttpResponse response,
-                final HttpContext context) throws HttpException, IOException {
-            throw new IOException();
-        }
-    }
-
     private static class BasicService implements HttpRequestHandler {
         public void handle(final HttpRequest request,
                 final HttpResponse response,
@@ -340,7 +310,7 @@ public class TestDefaultClientRequestDir
         }
     }
 
-    private static class ConnMan4 extends ThreadSafeClientConnManager {
+    private static class ConnMan4 extends PoolingClientConnectionManager {
         private final CountDownLatch connLatch;
         private final CountDownLatch awaitLatch;
 
@@ -387,29 +357,6 @@ public class TestDefaultClientRequestDir
     }
 
 
-    private static class ConnMan3 extends SingleClientConnManager {
-        private ManagedClientConnection allocatedConnection;
-        private ManagedClientConnection releasedConnection;
-
-        public ConnMan3(SchemeRegistry schreg) {
-            super(schreg);
-        }
-
-        @Override
-        public ManagedClientConnection getConnection(HttpRoute route, Object state) {
-            allocatedConnection = super.getConnection(route, state);
-            return allocatedConnection;
-        }
-
-        @Override
-        public void releaseConnection(ManagedClientConnection conn, long validDuration, TimeUnit timeUnit) {
-            releasedConnection = conn;
-            super.releaseConnection(conn, validDuration, timeUnit);
-        }
-
-
-    }
-
     static class ConnMan2 implements ClientConnectionManager {
 
         private ManagedClientConnection allocatedConnection;

Modified: httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/impl/client/TestRequestRetryHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/impl/client/TestRequestRetryHandler.java?rev=1154914&r1=1154913&r2=1154914&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/impl/client/TestRequestRetryHandler.java (original)
+++ httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/impl/client/TestRequestRetryHandler.java Mon Aug  8 10:51:10 2011
@@ -38,8 +38,7 @@ import org.apache.http.conn.ConnectTimeo
 import org.apache.http.conn.scheme.Scheme;
 import org.apache.http.conn.scheme.SchemeRegistry;
 import org.apache.http.conn.scheme.SchemeSocketFactory;
-import org.apache.http.impl.conn.SingleClientConnManager;
-import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
+import org.apache.http.impl.conn.PoolingClientConnectionManager;
 import org.apache.http.params.HttpConnectionParams;
 import org.apache.http.params.HttpParams;
 import org.apache.http.protocol.HttpContext;
@@ -49,26 +48,16 @@ import org.junit.Test;
 public class TestRequestRetryHandler {
 
     @Test(expected=UnknownHostException.class)
-    public void testUseRetryHandlerInConnectionTimeOutWithThreadSafeClientConnManager()
+    public void testUseRetryHandlerInConnectionTimeOut()
             throws Exception {
 
         SchemeRegistry schemeRegistry = new SchemeRegistry();
         schemeRegistry.register(new Scheme("http", 80, new OppsieSchemeSocketFactory()));
-        ClientConnectionManager connManager = new ThreadSafeClientConnManager(schemeRegistry);
+        ClientConnectionManager connManager = new PoolingClientConnectionManager(schemeRegistry);
 
         assertOnRetry(connManager);
     }
 
-    @Test(expected=UnknownHostException.class)
-    public void testUseRetryHandlerInConnectionTimeOutWithSingleClientConnManager()
-            throws Exception {
-
-        SchemeRegistry schemeRegistry = new SchemeRegistry();
-        schemeRegistry.register(new Scheme("http", 80, new OppsieSchemeSocketFactory()));
-        ClientConnectionManager connManager = new SingleClientConnManager(schemeRegistry);
-        assertOnRetry(connManager);
-    }
-
     protected void assertOnRetry(ClientConnectionManager connManager) throws Exception {
         DefaultHttpClient client = new DefaultHttpClient(connManager);
         TestHttpRequestRetryHandler testRetryHandler = new TestHttpRequestRetryHandler();

Modified: httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/impl/client/TestStatefulConnManagement.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/impl/client/TestStatefulConnManagement.java?rev=1154914&r1=1154913&r2=1154914&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/impl/client/TestStatefulConnManagement.java (original)
+++ httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/impl/client/TestStatefulConnManagement.java Mon Aug  8 10:51:10 2011
@@ -37,7 +37,7 @@ import org.apache.http.client.UserTokenH
 import org.apache.http.client.methods.HttpGet;
 import org.apache.http.conn.ManagedClientConnection;
 import org.apache.http.entity.StringEntity;
-import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
+import org.apache.http.impl.conn.PoolingClientConnectionManager;
 import org.apache.http.localserver.ServerTestBase;
 import org.apache.http.params.BasicHttpParams;
 import org.apache.http.params.HttpConnectionParams;
@@ -85,7 +85,7 @@ public class TestStatefulConnManagement 
         HttpParams params = new BasicHttpParams();
         HttpConnectionParams.setConnectionTimeout(params, 10);
 
-        ThreadSafeClientConnManager mgr = new ThreadSafeClientConnManager(supportedSchemes);
+        PoolingClientConnectionManager mgr = new PoolingClientConnectionManager(supportedSchemes);
         mgr.setMaxTotal(workerCount);
         mgr.setDefaultMaxPerRoute(workerCount);
 
@@ -207,7 +207,7 @@ public class TestStatefulConnManagement 
         this.localServer.register("*", new SimpleService());
 
         // We build a client with 2 max active // connections, and 2 max per route.
-        ThreadSafeClientConnManager connMngr = new ThreadSafeClientConnManager(supportedSchemes);
+        PoolingClientConnectionManager connMngr = new PoolingClientConnectionManager(supportedSchemes);
         connMngr.setMaxTotal(maxConn);
         connMngr.setDefaultMaxPerRoute(maxConn);
 

Modified: httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/impl/conn/ExecReqThread.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/impl/conn/ExecReqThread.java?rev=1154914&r1=1154913&r2=1154914&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/impl/conn/ExecReqThread.java (original)
+++ httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/impl/conn/ExecReqThread.java Mon Aug  8 10:51:10 2011
@@ -111,10 +111,9 @@ public class ExecReqThread extends GetCo
 
             doConsumeResponse();
 
-        } catch (Throwable dart) {
-            dart.printStackTrace(System.out);
+        } catch (Exception ex) {
             if (exception != null)
-                exception = dart;
+                exception = ex;
 
         } finally {
             conn_manager.releaseConnection(connection, -1, null);

Modified: httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/impl/conn/GetConnThread.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/impl/conn/GetConnThread.java?rev=1154914&r1=1154913&r2=1154914&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/impl/conn/GetConnThread.java (original)
+++ httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/impl/conn/GetConnThread.java Mon Aug  8 10:51:10 2011
@@ -47,7 +47,7 @@ public class GetConnThread extends Threa
     protected final ClientConnectionRequest conn_request;
 
     protected volatile ManagedClientConnection connection;
-    protected volatile Throwable               exception;
+    protected volatile Exception               exception;
 
     /**
      * Creates a new thread for requesting a connection from the given manager.
@@ -81,8 +81,8 @@ public class GetConnThread extends Threa
         try {
             connection = conn_request.getConnection
                 (conn_timeout, TimeUnit.MILLISECONDS);
-        } catch (Throwable dart) {
-            exception = dart;
+        } catch (Exception ex) {
+            exception = ex;
         }
         // terminate
     }

Modified: httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/impl/conn/TestDefaultResponseParser.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/impl/conn/TestDefaultResponseParser.java?rev=1154914&r1=1154913&r2=1154914&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/impl/conn/TestDefaultResponseParser.java (original)
+++ httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/impl/conn/TestDefaultResponseParser.java Mon Aug  8 10:51:10 2011
@@ -60,7 +60,7 @@ public class TestDefaultResponseParser {
 
         HttpParams params = new BasicHttpParams();
         SessionInputBuffer inbuffer = new SessionInputBufferMockup(s, "US-ASCII", params);
-        HttpMessageParser parser = new DefaultResponseParser(
+        HttpMessageParser<HttpResponse> parser = new DefaultResponseParser(
                 inbuffer,
                 BasicLineParser.DEFAULT,
                 new DefaultHttpResponseFactory(),
@@ -91,7 +91,7 @@ public class TestDefaultResponseParser {
 
         HttpParams params = new BasicHttpParams();
         SessionInputBuffer inbuffer = new SessionInputBufferMockup(s, "US-ASCII", params);
-        HttpMessageParser parser = new DefaultResponseParser(
+        HttpMessageParser<HttpResponse> parser = new DefaultResponseParser(
                 inbuffer,
                 BasicLineParser.DEFAULT,
                 new DefaultHttpResponseFactory(),
@@ -110,7 +110,7 @@ public class TestDefaultResponseParser {
     public void testResponseParsingNoResponse() throws Exception {
         HttpParams params = new BasicHttpParams();
         SessionInputBuffer inbuffer = new SessionInputBufferMockup("", "US-ASCII", params);
-        HttpMessageParser parser = new DefaultResponseParser(
+        HttpMessageParser<HttpResponse> parser = new DefaultResponseParser(
                 inbuffer,
                 BasicLineParser.DEFAULT,
                 new DefaultHttpResponseFactory(),
@@ -127,7 +127,7 @@ public class TestDefaultResponseParser {
             "a lot more garbage\r\n";
         HttpParams params = new BasicHttpParams();
         SessionInputBuffer inbuffer = new SessionInputBufferMockup(s, "US-ASCII", params);
-        HttpMessageParser parser = new DefaultResponseParser(
+        HttpMessageParser<HttpResponse> parser = new DefaultResponseParser(
                 inbuffer,
                 BasicLineParser.DEFAULT,
                 new DefaultHttpResponseFactory(),

Modified: httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/impl/conn/TestIdleConnectionEviction.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/impl/conn/TestIdleConnectionEviction.java?rev=1154914&r1=1154913&r2=1154914&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/impl/conn/TestIdleConnectionEviction.java (original)
+++ httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/impl/conn/TestIdleConnectionEviction.java Mon Aug  8 10:51:10 2011
@@ -41,7 +41,6 @@ import org.apache.http.conn.scheme.Plain
 import org.apache.http.conn.scheme.Scheme;
 import org.apache.http.conn.scheme.SchemeRegistry;
 import org.apache.http.impl.client.DefaultHttpClient;
-import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
 import org.apache.http.localserver.LocalTestServer;
 import org.apache.http.localserver.ServerTestBase;
 import org.apache.http.params.BasicHttpParams;
@@ -69,7 +68,7 @@ public class TestIdleConnectionEviction 
         SchemeRegistry schemeRegistry = new SchemeRegistry();
         schemeRegistry.register(new Scheme("http", 80, PlainSocketFactory.getSocketFactory()));
 
-        ThreadSafeClientConnManager cm = new ThreadSafeClientConnManager(schemeRegistry);
+        PoolingClientConnectionManager cm = new PoolingClientConnectionManager(schemeRegistry);
         cm.setDefaultMaxPerRoute(10);
         cm.setMaxTotal(50);
 

Modified: httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/impl/conn/TestSCMWithServer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/impl/conn/TestSCMWithServer.java?rev=1154914&r1=1154913&r2=1154914&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/impl/conn/TestSCMWithServer.java (original)
+++ httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/impl/conn/TestSCMWithServer.java Mon Aug  8 10:51:10 2011
@@ -44,6 +44,7 @@ import org.apache.http.util.EntityUtils;
 import org.junit.Assert;
 import org.junit.Test;
 
+@Deprecated
 public class TestSCMWithServer extends ServerTestBase {
 
     /**

Modified: httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/impl/conn/TestTSCCMNoServer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/impl/conn/TestTSCCMNoServer.java?rev=1154914&r1=1154913&r2=1154914&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/impl/conn/TestTSCCMNoServer.java (original)
+++ httpcomponents/httpclient/branches/conn-mgmt-redesign/httpclient/src/test/java/org/apache/http/impl/conn/TestTSCCMNoServer.java Mon Aug  8 10:51:10 2011
@@ -36,10 +36,6 @@ import org.apache.http.conn.ClientConnec
 import org.apache.http.conn.ConnectionPoolTimeoutException;
 import org.apache.http.conn.ManagedClientConnection;
 import org.apache.http.conn.routing.HttpRoute;
-import org.apache.http.conn.scheme.PlainSocketFactory;
-import org.apache.http.conn.scheme.Scheme;
-import org.apache.http.conn.scheme.SchemeRegistry;
-import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
 import org.apache.http.params.BasicHttpParams;
 import org.apache.http.params.HttpParams;
 import org.apache.http.params.HttpProtocolParams;
@@ -69,21 +65,6 @@ public class TestTSCCMNoServer {
     }
 
     /**
-     * Helper to instantiate a <code>ThreadSafeClientConnManager</code>.
-     *
-     * @param schreg    the scheme registry, or
-     *                  <code>null</code> to use defaults
-     *
-     * @return  a connection manager to test
-     */
-    public ThreadSafeClientConnManager createTSCCM(SchemeRegistry schreg) {
-        if (schreg == null)
-            schreg = createSchemeRegistry();
-        return new ThreadSafeClientConnManager(schreg);
-    }
-
-
-    /**
      * Instantiates default parameters.
      *
      * @return  the default parameters
@@ -97,37 +78,15 @@ public class TestTSCCMNoServer {
         return params;
     }
 
-    /**
-     * Instantiates a default scheme registry.
-     *
-     * @return the default scheme registry
-     */
-    public SchemeRegistry createSchemeRegistry() {
-
-        SchemeRegistry schreg = new SchemeRegistry();
-        schreg.register(new Scheme("http", 80, PlainSocketFactory.getSocketFactory()));
-
-        return schreg;
-    }
-
-    @Test
-    public void testConstructor() {
-        SchemeRegistry schreg = createSchemeRegistry();
-
-        ThreadSafeClientConnManager mgr = new ThreadSafeClientConnManager(schreg);
-        Assert.assertNotNull(mgr);
-        mgr.shutdown();
-    }
-
     @Test(expected=IllegalArgumentException.class)
     public void testIllegalConstructor() {
-        new ThreadSafeClientConnManager(null);
+        new PoolingClientConnectionManager(null);
     }
 
     @Test(expected=IllegalArgumentException.class)
     public void testGetConnection()
             throws InterruptedException, ConnectionPoolTimeoutException {
-        ThreadSafeClientConnManager mgr = createTSCCM(null);
+        PoolingClientConnectionManager mgr = new PoolingClientConnectionManager();
 
         HttpHost target = new HttpHost("www.test.invalid", 80, "http");
         HttpRoute route = new HttpRoute(target, null, false);
@@ -152,7 +111,7 @@ public class TestTSCCMNoServer {
     public void testMaxConnTotal()
             throws InterruptedException, ConnectionPoolTimeoutException {
 
-        ThreadSafeClientConnManager mgr = createTSCCM(null);
+        PoolingClientConnectionManager mgr = new PoolingClientConnectionManager();
         mgr.setMaxTotal(2);
         mgr.setDefaultMaxPerRoute(1);
 
@@ -198,11 +157,11 @@ public class TestTSCCMNoServer {
         HttpHost target3 = new HttpHost("www.test3.invalid", 80, "http");
         HttpRoute route3 = new HttpRoute(target3, null, false);
 
-        ThreadSafeClientConnManager mgr = createTSCCM(null);
+        PoolingClientConnectionManager mgr = new PoolingClientConnectionManager();
         mgr.setMaxTotal(100);
         mgr.setDefaultMaxPerRoute(1);
-        mgr.setMaxForRoute(route2, 2);
-        mgr.setMaxForRoute(route3, 3);
+        mgr.setMaxPerRoute(route2, 2);
+        mgr.setMaxPerRoute(route3, 3);
 
         // route 3, limit 3
         ManagedClientConnection conn1 =
@@ -264,7 +223,7 @@ public class TestTSCCMNoServer {
     @Test
     public void testReleaseConnection() throws Exception {
 
-        ThreadSafeClientConnManager mgr = createTSCCM(null);
+        PoolingClientConnectionManager mgr = new PoolingClientConnectionManager();
         mgr.setMaxTotal(3);
         mgr.setDefaultMaxPerRoute(1);
 
@@ -333,31 +292,26 @@ public class TestTSCCMNoServer {
     public void testDeleteClosedConnections()
             throws InterruptedException, ConnectionPoolTimeoutException {
 
-        ThreadSafeClientConnManager mgr = createTSCCM(null);
+        PoolingClientConnectionManager mgr = new PoolingClientConnectionManager();
 
         HttpHost target = new HttpHost("www.test.invalid", 80, "http");
         HttpRoute route = new HttpRoute(target, null, false);
 
         ManagedClientConnection conn = getConnection(mgr, route);
 
-        Assert.assertEquals("connectionsInPool",
-                     mgr.getConnectionsInPool(), 1);
-        Assert.assertEquals("connectionsInPool(host)",
-                     mgr.getConnectionsInPool(route), 1);
+        Assert.assertEquals(1, mgr.getTotalStats().getLeased());
+        Assert.assertEquals(1, mgr.getStats(route).getLeased());
+        conn.markReusable();
         mgr.releaseConnection(conn, -1, null);
 
-        Assert.assertEquals("connectionsInPool",
-                     mgr.getConnectionsInPool(), 1);
-        Assert.assertEquals("connectionsInPool(host)",
-                     mgr.getConnectionsInPool(route), 1);
+        Assert.assertEquals(1, mgr.getTotalStats().getAvailable());
+        Assert.assertEquals(1, mgr.getStats(route).getAvailable());
 
         // this implicitly deletes them
         mgr.closeIdleConnections(0L, TimeUnit.MILLISECONDS);
 
-        Assert.assertEquals("connectionsInPool",
-                     mgr.getConnectionsInPool(), 0);
-        Assert.assertEquals("connectionsInPool(host)",
-                     mgr.getConnectionsInPool(route), 0);
+        Assert.assertEquals(0, mgr.getTotalStats().getAvailable());
+        Assert.assertEquals(0, mgr.getStats(route).getAvailable());
 
         mgr.shutdown();
     }
@@ -366,7 +320,7 @@ public class TestTSCCMNoServer {
     public void testShutdown() throws Exception {
         // 3.x: TestHttpConnectionManager.testShutdown
 
-        ThreadSafeClientConnManager mgr = createTSCCM(null);
+        PoolingClientConnectionManager mgr = new PoolingClientConnectionManager();
         mgr.setMaxTotal(1);
         mgr.setDefaultMaxPerRoute(1);
 
@@ -397,7 +351,7 @@ public class TestTSCCMNoServer {
         Assert.assertNotNull("thread should have gotten an exception",
                       gct.getException());
         Assert.assertSame("thread got wrong exception",
-                   IllegalStateException.class, gct.getException().getClass());
+                InterruptedException.class, gct.getException().getClass());
 
         // the manager is down, we should not be able to get a connection
         try {
@@ -412,7 +366,7 @@ public class TestTSCCMNoServer {
     public void testInterruptThread() throws Exception {
         // 3.x: TestHttpConnectionManager.testWaitingThreadInterrupted
 
-        ThreadSafeClientConnManager mgr = createTSCCM(null);
+        PoolingClientConnectionManager mgr = new PoolingClientConnectionManager();
         mgr.setMaxTotal(1);
 
         HttpHost target = new HttpHost("www.test.invalid", 80, "http");
@@ -457,7 +411,7 @@ public class TestTSCCMNoServer {
     public void testReusePreference() throws Exception {
         // 3.x: TestHttpConnectionManager.testHostReusePreference
 
-        ThreadSafeClientConnManager mgr = createTSCCM(null);
+        PoolingClientConnectionManager mgr = new PoolingClientConnectionManager();
         mgr.setMaxTotal(1);
 
         HttpHost target1 = new HttpHost("www.test1.invalid", 80, "http");
@@ -496,7 +450,7 @@ public class TestTSCCMNoServer {
 
     @Test
     public void testAbortAfterRequestStarts() throws Exception {
-        ThreadSafeClientConnManager mgr = createTSCCM(null);
+        PoolingClientConnectionManager mgr = new PoolingClientConnectionManager();
         mgr.setMaxTotal(1);
 
         HttpHost target = new HttpHost("www.test.invalid", 80, "http");
@@ -536,7 +490,7 @@ public class TestTSCCMNoServer {
 
     @Test
     public void testAbortBeforeRequestStarts() throws Exception {
-        ThreadSafeClientConnManager mgr = createTSCCM(null);
+        PoolingClientConnectionManager mgr = new PoolingClientConnectionManager();
         mgr.setMaxTotal(1);
 
         HttpHost target = new HttpHost("www.test.invalid", 80, "http");



Mime
View raw message