You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ro...@apache.org on 2007/07/21 14:51:40 UTC

svn commit: r558326 - /jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/ThreadSafeClientConnManager.java

Author: rolandw
Date: Sat Jul 21 05:51:37 2007
New Revision: 558326

URL: http://svn.apache.org/viewvc?view=rev&rev=558326
Log:
cosmetic renaming

Modified:
    jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/ThreadSafeClientConnManager.java

Modified: jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/ThreadSafeClientConnManager.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/ThreadSafeClientConnManager.java?view=diff&rev=558326&r1=558325&r2=558326
==============================================================================
--- jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/ThreadSafeClientConnManager.java (original)
+++ jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/ThreadSafeClientConnManager.java Sat Jul 21 05:51:37 2007
@@ -73,8 +73,8 @@
 public class ThreadSafeClientConnManager
     implements ClientConnectionManager {
 
-
-    private static final Log LOG =
+    //@@@ LOG must be static for now, it's used in static methods
+    private final static Log LOG =
         LogFactory.getLog(ThreadSafeClientConnManager.class);
 
     /**
@@ -264,7 +264,7 @@
                         }
                         
                         if (LOG.isDebugEnabled()) {
-                            LOG.debug("Unable to get a connection, waiting..., hostConfig=" + route);
+                            LOG.debug("Unable to get a connection, waiting..., route=" + route);
                         }
                         
                         if (waitingThread == null) {
@@ -481,20 +481,20 @@
      * keeps a strong reference.
      * 
      * @param connection        the pool entry to store a reference for
-     * @param hostConfiguration the connection's route
+     * @param route             the connection's planned route
      * @param connectionPool    the connection pool that created the entry
      * 
      * @see #removeReferenceToConnection
      */
     private static void storeReferenceToConnection(
         TrackingPoolEntry connection,
-        HttpRoute hostConfiguration,
+        HttpRoute route,
         ConnectionPool connectionPool
     ) {
 
         ConnectionSource source = new ConnectionSource();
         source.connectionPool = connectionPool;
-        source.hostConfiguration = hostConfiguration;
+        source.route = route;
 
         synchronized (REFERENCE_TO_CONNECTION_SOURCE) {
 
@@ -599,12 +599,12 @@
      * by this connection manager for the host configuration.  This value will
      * not exceed the maximum number of connections per host.
      * 
-     * @param hostConfiguration The host configuration
+     * @param route The host configuration
      * @return The total number of pooled connections
      */
-    public int getConnectionsInPool(HttpRoute hostConfiguration) {
+    public int getConnectionsInPool(HttpRoute route) {
         synchronized (connectionPool) {
-            HostConnectionPool hostPool = connectionPool.getHostPool(hostConfiguration);
+            HostConnectionPool hostPool = connectionPool.getHostPool(route);
             return hostPool.numConnections;
         }
     }
@@ -737,7 +737,7 @@
 
             HostConnectionPool hostPool = getHostPool(route);
             if (LOG.isDebugEnabled()) {
-                LOG.debug("Allocating new connection, hostConfiguration=" + route);
+                LOG.debug("Allocating new connection, route=" + route);
             }
             TrackingPoolEntry entry = new TrackingPoolEntry(conn);
             entry.plannedRoute = route;
@@ -785,7 +785,7 @@
             if (listConnections == null) {
                 // First time for this config
                 listConnections = new HostConnectionPool();
-                listConnections.hostConfiguration = route;
+                listConnections.route = route;
                 mapHosts.put(route, listConnections);
             }
 
@@ -796,30 +796,30 @@
         /**
          * If available, get a free connection for this host
          *
-         * @param hostConfiguration the configuraton for the connection pool
+         * @param route the configuraton for the connection pool
          * @return an available connection for the given config
          */
-        public synchronized TrackingPoolEntry getFreeConnection(HttpRoute hostConfiguration) {
+        public synchronized TrackingPoolEntry getFreeConnection(HttpRoute route) {
 
             TrackingPoolEntry entry = null;
 
-            HostConnectionPool hostPool = getHostPool(hostConfiguration);
+            HostConnectionPool hostPool = getHostPool(route);
 
             if (hostPool.freeConnections.size() > 0) {
                 entry = (TrackingPoolEntry) hostPool.freeConnections.removeLast();
                 freeConnections.remove(entry);
                 // store a reference to this entry so that it can be cleaned up
                 // in the event it is not correctly released
-                storeReferenceToConnection(entry, hostConfiguration, this);
+                storeReferenceToConnection(entry, route, this);
                 if (LOG.isDebugEnabled()) {
-                    LOG.debug("Getting free connection, hostConfig=" + hostConfiguration);
+                    LOG.debug("Getting free connection, route=" + route);
                 }
 
                 // remove the connection from the timeout handler
                 idleConnectionHandler.remove(entry.connection);
             } else if (LOG.isDebugEnabled()) {
-                LOG.debug("There were no free connections to get, hostConfig=" 
-                    + hostConfiguration);
+                LOG.debug("There were no free connections to get, route=" 
+                    + route);
             }
             return entry;
         }
@@ -865,7 +865,7 @@
             HttpRoute route = entry.plannedRoute;
 
             if (LOG.isDebugEnabled()) {
-                LOG.debug("Reclaiming connection, hostConfig=" + route);
+                LOG.debug("Reclaiming connection, route=" + route);
             }
 
             closeConnection(entry.connection);
@@ -923,8 +923,8 @@
                 
             if (hostPool.waitingThreads.size() > 0) {
                 if (LOG.isDebugEnabled()) {
-                    LOG.debug("Notifying thread waiting on host pool, hostConfig=" 
-                        + hostPool.hostConfiguration);
+                    LOG.debug("Notifying thread waiting on host pool, route=" 
+                        + hostPool.route);
                 }
                 waitingThread = (WaitingThread) hostPool.waitingThreads.removeFirst();
                 waitingThreads.remove(waitingThread);
@@ -954,7 +954,7 @@
             HttpRoute route = entry.plannedRoute;
 
             if (LOG.isDebugEnabled()) {
-                LOG.debug("Freeing connection, hostConfig=" + route);
+                LOG.debug("Freeing connection, route=" + route);
             }
 
             synchronized (this) {
@@ -973,7 +973,7 @@
                 hostPool.freeConnections.add(entry);
                 if (hostPool.numConnections == 0) {
                     // for some reason this connection pool didn't already exist
-                    LOG.error("Host connection pool not found, hostConfig=" 
+                    LOG.error("Host connection pool not found, route=" 
                               + route);
                     hostPool.numConnections = 1;
                 }
@@ -985,7 +985,7 @@
                 removeReferenceToConnection(entry);
                 if (numConnections == 0) {
                     // for some reason this connection pool didn't already exist
-                    LOG.error("Host connection pool not found, hostConfig=" 
+                    LOG.error("Host connection pool not found, route=" 
                               + route);
                     numConnections = 1;
                 }
@@ -1017,7 +1017,7 @@
         public ConnectionPool connectionPool;
 
         /** The connection's host configuration */
-        public HttpRoute hostConfiguration;
+        public HttpRoute route;
     }
     
     /**
@@ -1025,8 +1025,9 @@
      * of created connections.
      */
     private static class HostConnectionPool {
-        /** The hostConfig this pool is for */
-        public HttpRoute hostConfiguration;
+
+        /** The route this pool is for */
+        public HttpRoute route;
         
         /** The list of free connections */
         public LinkedList freeConnections = new LinkedList();
@@ -1098,11 +1099,11 @@
             if (source != null) {
                 if (LOG.isDebugEnabled()) {
                     LOG.debug(
-                        "Connection reclaimed by garbage collector, hostConfig=" 
-                        + source.hostConfiguration);
+                        "Connection reclaimed by garbage collector, route=" 
+                        + source.route);
                 }
                 
-                source.connectionPool.handleLostConnection(source.hostConfiguration);
+                source.connectionPool.handleLostConnection(source.route);
             }
         }