hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r767721 - /httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/SingleClientConnManager.java
Date Wed, 22 Apr 2009 23:32:52 GMT
Author: sebb
Date: Wed Apr 22 23:32:52 2009
New Revision: 767721

URL: http://svn.apache.org/viewvc?rev=767721&view=rev
Log:
Markup how fields are synchronized
Ensure finalize() always calls super.finalize()

Modified:
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/SingleClientConnManager.java

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/SingleClientConnManager.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/SingleClientConnManager.java?rev=767721&r1=767720&r2=767721&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/SingleClientConnManager.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/SingleClientConnManager.java
Wed Apr 22 23:32:52 2009
@@ -34,6 +34,7 @@
 import java.io.IOException;
 import java.util.concurrent.TimeUnit;
 
+import net.jcip.annotations.GuardedBy;
 import net.jcip.annotations.ThreadSafe;
 
 import org.apache.commons.logging.Log;
@@ -82,12 +83,14 @@
     protected PoolEntry uniquePoolEntry;
 
     /** The currently issued managed connection, if any. */
+    @GuardedBy("this")
     protected ConnAdapter managedConn;
 
     /** The time of the last connection release, or -1. */
     protected long lastReleaseTime;
     
     /** The time the last released connection expires and shouldn't be reused. */
+    @GuardedBy("this")
     protected long connectionExpiresTime;
 
     /** Whether the connection should be shut down  on release. */
@@ -120,8 +123,11 @@
 
     @Override
     protected void finalize() throws Throwable {
-        shutdown();
-        super.finalize();
+        try {
+            shutdown();
+        } finally { // Make sure we call overridden method even if shutdown barfs
+            super.finalize();
+        }
     }
 
     public SchemeRegistry getSchemeRegistry() {



Mime
View raw message