Return-Path: Delivered-To: apmail-hc-commits-archive@www.apache.org Received: (qmail 90871 invoked from network); 20 Mar 2009 23:05:29 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 20 Mar 2009 23:05:29 -0000 Received: (qmail 64041 invoked by uid 500); 20 Mar 2009 23:05:29 -0000 Delivered-To: apmail-hc-commits-archive@hc.apache.org Received: (qmail 64011 invoked by uid 500); 20 Mar 2009 23:05:29 -0000 Mailing-List: contact commits-help@hc.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "HttpComponents Project" Delivered-To: mailing list commits@hc.apache.org Received: (qmail 64001 invoked by uid 99); 20 Mar 2009 23:05:29 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 20 Mar 2009 16:05:29 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 20 Mar 2009 23:05:28 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 238872388965; Fri, 20 Mar 2009 23:05:08 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r756799 - in /httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn: IdleConnectionHandler.java tsccm/AbstractConnPool.java tsccm/RouteSpecificPool.java Date: Fri, 20 Mar 2009 23:05:07 -0000 To: commits@hc.apache.org From: sebb@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090320230508.238872388965@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: sebb Date: Fri Mar 20 23:05:07 2009 New Revision: 756799 URL: http://svn.apache.org/viewvc?rev=756799&view=rev Log: Concurrency documentation Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/IdleConnectionHandler.java httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/AbstractConnPool.java httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/RouteSpecificPool.java Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/IdleConnectionHandler.java URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/IdleConnectionHandler.java?rev=756799&r1=756798&r2=756799&view=diff ============================================================================== --- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/IdleConnectionHandler.java (original) +++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/IdleConnectionHandler.java Fri Mar 20 23:05:07 2009 @@ -35,11 +35,13 @@ import java.util.Map; import java.util.concurrent.TimeUnit; +import net.jcip.annotations.NotThreadSafe; + import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.http.HttpConnection; - +// Currently only used by AbstractConnPool /** * A helper class for connection managers to track idle connections. * @@ -49,6 +51,7 @@ * * @since 4.0 */ +@NotThreadSafe public class IdleConnectionHandler { private final Log log = LogFactory.getLog(getClass()); Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/AbstractConnPool.java URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/AbstractConnPool.java?rev=756799&r1=756798&r2=756799&view=diff ============================================================================== --- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/AbstractConnPool.java (original) +++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/AbstractConnPool.java Fri Mar 20 23:05:07 2009 @@ -60,7 +60,7 @@ * * @since 4.0 */ -@NotThreadSafe // unsynch access to queues etc +@NotThreadSafe // unsynch access to refQueue, refWorker public abstract class AbstractConnPool implements RefQueueHandler { private final Log log = LogFactory.getLog(getClass()); @@ -77,10 +77,13 @@ * {@link BasicPoolEntryRef BasicPoolEntryRef}, * and point to the pool entry for the issued connection. * GCed connections are detected by the missing pool entries. + * Must hold poolLock when accessing. */ + @GuardedBy("poolLock") protected Set issuedConnections; - /** The handler for idle connections. */ + /** The handler for idle connections. Must hold poolLock when accessing. */ + @GuardedBy("poolLock") protected IdleConnectionHandler idleConnHandler; /** The current total number of connections. */ @@ -92,9 +95,11 @@ * The same queue is used to track loss of the connection manager, * so we cannot specialize the type. */ + // TODO - this needs to be synchronized, e.g. on Pool Lock protected ReferenceQueue refQueue; /** A worker (thread) to track loss of pool entries to GC. */ + // TODO - this needs to be synchronized, e.g. on Pool Lock private RefQueueWorker refWorker; @@ -127,7 +132,7 @@ public void enableConnectionGC() throws IllegalStateException { - if (refQueue != null) { + if (refQueue != null) { // TODO - this access is not guaranteed protected by the pool lock throw new IllegalStateException("Connection GC already enabled."); } poolLock.lock(); Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/RouteSpecificPool.java URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/RouteSpecificPool.java?rev=756799&r1=756798&r2=756799&view=diff ============================================================================== --- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/RouteSpecificPool.java (original) +++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/RouteSpecificPool.java Fri Mar 20 23:05:07 2009 @@ -35,6 +35,8 @@ import java.util.Queue; import java.util.LinkedList; +import net.jcip.annotations.NotThreadSafe; + import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.http.conn.OperatedClientConnection; @@ -49,12 +51,13 @@ * * @since 4.0 */ +@NotThreadSafe // e.g. numEntries, freeEntries, public class RouteSpecificPool { private final Log log = LogFactory.getLog(getClass()); /** The route this pool is for. */ - protected final HttpRoute route; + protected final HttpRoute route; //Immutable /** the maximum number of entries allowed for this pool */ protected final int maxEntries;