hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r691587 - in /httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl: client/ conn/tsccm/
Date Wed, 03 Sep 2008 12:22:56 GMT
Author: olegk
Date: Wed Sep  3 05:22:55 2008
New Revision: 691587

URL: http://svn.apache.org/viewvc?rev=691587&view=rev
Log:
Improved DEBUG log statements; reduced noise in the context logging

Modified:
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/ClientParamsStack.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/DefaultRequestDirector.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/RequestWrapper.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/ConnPoolByRoute.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/ThreadSafeClientConnManager.java

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/ClientParamsStack.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/ClientParamsStack.java?rev=691587&r1=691586&r2=691587&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/ClientParamsStack.java
(original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/ClientParamsStack.java
Wed Sep  3 05:22:55 2008
@@ -215,7 +215,7 @@
         if ((result == null) && (applicationParams != null)) {
             result = applicationParams.getParameter(name);
         }
-        if (this.log.isDebugEnabled()) {
+        if (this.log.isDebugEnabled() && result != null) {
             this.log.debug("'" + name + "': " + result);
         }
 

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/DefaultRequestDirector.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/DefaultRequestDirector.java?rev=691587&r1=691586&r2=691587&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/DefaultRequestDirector.java
(original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/DefaultRequestDirector.java
Wed Sep  3 05:22:55 2008
@@ -330,10 +330,12 @@
 
                     if (HttpConnectionParams.isStaleCheckingEnabled(params)) {
                         // validate connection
-                        this.log.debug("Stale connection check");
-                        if (managedConn.isStale()) {
-                            this.log.debug("Stale connection detected");
-                            managedConn.close();
+                        if (managedConn.isOpen()) {
+                            this.log.debug("Stale connection check");
+                            if (managedConn.isStale()) {
+                                this.log.debug("Stale connection detected");
+                                managedConn.close();
+                            }
                         }
                     }
                 }
@@ -446,10 +448,14 @@
 
                 // The connection is in or can be brought to a re-usable state.
                 reuse = reuseStrategy.keepAlive(response, context);
-                if(reuse) {
+                if (reuse) {
                     // Set the idle duration of this connection
                     long duration = keepAliveStrategy.getKeepAliveDuration(response, context);
                     managedConn.setIdleDuration(duration, TimeUnit.MILLISECONDS);
+
+                    if (this.log.isDebugEnabled()) {
+                        this.log.debug("Connection can be kept alive for " + duration + "
ms");
+                    }
                 }
                 
                 RoutedRequest followup = handleResponse(roureq, response, context);
@@ -457,7 +463,6 @@
                     done = true;
                 } else {
                     if (reuse) {
-                        this.log.debug("Connection kept alive");
                         // Make sure the response body is fully consumed, if present
                         HttpEntity entity = response.getEntity();
                         if (entity != null) {

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/RequestWrapper.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/RequestWrapper.java?rev=691587&r1=691586&r2=691587&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/RequestWrapper.java
(original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/RequestWrapper.java
Wed Sep  3 05:22:55 2008
@@ -110,11 +110,10 @@
     }
 
     public ProtocolVersion getProtocolVersion() {
-        if (this.version != null) {
-            return this.version;
-        } else {
-            return HttpProtocolParams.getVersion(getParams());
+        if (this.version == null) {
+            this.version = HttpProtocolParams.getVersion(getParams());
         }
+        return this.version;
     }
 
     public void setProtocolVersion(final ProtocolVersion version) {

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/ConnPoolByRoute.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/ConnPoolByRoute.java?rev=691587&r1=691586&r2=691587&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/ConnPoolByRoute.java
(original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/ConnPoolByRoute.java
Wed Sep  3 05:22:55 2008
@@ -371,7 +371,7 @@
 
         HttpRoute route = entry.getPlannedRoute();
         if (log.isDebugEnabled()) {
-            log.debug("Freeing connection" +                                 
+            log.debug("Releasing connection" +                                 
                     " [" + route + "][" + entry.getState() + "]");
         }
 
@@ -390,6 +390,11 @@
             RouteSpecificPool rospl = getRoutePool(route, true);
 
             if (reusable) {
+                if (log.isDebugEnabled()) {
+                    log.debug("Pooling connection" +                                 
+                            " [" + route + "][" + entry.getState() + "]" +
+                            "; keep alive for " + validDuration + " " + timeUnit.toString());
+                }
                 rospl.freeEntry(entry);
                 freeConnections.add(entry);
                 idleConnHandler.add(entry.getConnection(), validDuration, timeUnit);

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/ThreadSafeClientConnManager.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/ThreadSafeClientConnManager.java?rev=691587&r1=691586&r2=691587&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/ThreadSafeClientConnManager.java
(original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/ThreadSafeClientConnManager.java
Wed Sep  3 05:22:55 2008
@@ -198,10 +198,6 @@
         try {
             // make sure that the response has been read completely
             if (hca.isOpen() && !hca.isMarkedReusable()) {
-                if (log.isDebugEnabled()) {
-                    log.debug
-                        ("Released connection open but not marked reusable.");
-                }
                 // In MTHCM, there would be a call to
                 // SimpleHttpConnectionManager.finishLastResponse(conn);
                 // Consuming the response is handled outside in 4.0.
@@ -220,6 +216,13 @@
         } finally {
             BasicPoolEntry entry = (BasicPoolEntry) hca.getPoolEntry();
             boolean reusable = hca.isMarkedReusable();
+            if (log.isDebugEnabled()) {
+                if (reusable) {
+                    log.debug("Released connection is reusable.");
+                } else {
+                    log.debug("Released connection is not reusable.");
+                }
+            }
             hca.detach();
             if (entry != null) {
                 connectionPool.freeEntry(entry, reusable, validDuration, timeUnit);



Mime
View raw message