From 04fa90ceff85c54b4e1faf81f4883f8803f630dd Mon Sep 17 00:00:00 2001 From: Oleg Kalnichevski Date: Thu, 23 Apr 2009 18:49:21 +0000 Subject: [PATCH] Made #revokeConnection() synchronized and alwaysShutDown final git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@768009 13f79535-47bb-0310-9956-ffa450edef68 --- .../http/impl/conn/SingleClientConnManager.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/httpclient/src/main/java/org/apache/http/impl/conn/SingleClientConnManager.java b/httpclient/src/main/java/org/apache/http/impl/conn/SingleClientConnManager.java index d78d33a98..4cdadf685 100644 --- a/httpclient/src/main/java/org/apache/http/impl/conn/SingleClientConnManager.java +++ b/httpclient/src/main/java/org/apache/http/impl/conn/SingleClientConnManager.java @@ -72,14 +72,17 @@ public class SingleClientConnManager implements ClientConnectionManager { "Invalid use of SingleClientConnManager: connection still allocated.\n" + "Make sure to release the connection before allocating another one."; - /** The schemes supported by this connection manager. */ protected final SchemeRegistry schemeRegistry; /** The operator for opening and updating connections. */ protected final ClientConnectionOperator connOperator; + /** Whether the connection should be shut down on release. */ + protected final boolean alwaysShutDown; + /** The one and only entry in this pool. */ + @GuardedBy("this") protected PoolEntry uniquePoolEntry; /** The currently issued managed connection, if any. */ @@ -87,15 +90,13 @@ public class SingleClientConnManager implements ClientConnectionManager { protected ConnAdapter managedConn; /** The time of the last connection release, or -1. */ + @GuardedBy("this") 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. */ - protected boolean alwaysShutDown; - /** Indicates whether this connection manager is shut down. */ protected volatile boolean isShutDown; @@ -342,7 +343,7 @@ public class SingleClientConnManager implements ClientConnectionManager { * @deprecated no longer used */ @Deprecated - protected void revokeConnection() { + protected synchronized void revokeConnection() { if (managedConn == null) return; managedConn.detach();