Author: kkolinko
Date: Sat May 12 17:24:07 2012
New Revision: 1337597

URL: http://svn.apache.org/viewvc?rev=1337597&view=rev
Log:
Merged revisions r1337591 r1337595 from tomcat/trunk:
Followup to r1336516
Add Javadoc (as asked by sebb) and avoid looking up a volatile field twice

Modified:
    tomcat/tc7.0.x/trunk/   (props changed)
    tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java

Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
  Merged /tomcat/trunk:r1337591-1337595

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java?rev=1337597&r1=1337596&r2=1337597&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java 
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java 
Sat May 12 17:24:07 2012
@@ -174,9 +174,24 @@ public abstract class AbstractEndpoint {
 
     public int  getMaxConnections() { return this.maxConnections; }
 
+    /**
+     * Return the current count of connections handled by this endpoint, if the
+     * connections are counted (which happens when the maximum count of
+     * connections is limited), or <code>-1</code> if they are not. This
+     * property is added here so that this value can be inspected through JMX.
+     * It is visible on "ThreadPool" MBean.
+     *
+     * <p>The count is incremented by the Acceptor before it tries to accept a
+     * new connection. Until the limit is reached and thus the count cannot be
+     * incremented,  this value is more by 1 (the count of acceptors) than the
+     * actual count of connections that are being served.
+     *
+     * @return The count
+     */
     public long getConnectionCount() {
-        if (connectionLimitLatch != null) {
-            return connectionLimitLatch.getCount();
+        LimitLatch latch = connectionLimitLatch;
+        if (latch != null) {
+            return latch.getCount();
         }
         return -1;
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to