Author: kkolinko Date: Sat May 12 16:51:02 2012 New Revision: 1337591 URL: http://svn.apache.org/viewvc?rev=1337591&view=rev Log: Followup to r1336516 Add Javadoc (as asked by sebb) and avoid looking up a volatile field twice
Modified: tomcat/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java Modified: tomcat/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java?rev=1337591&r1=1337590&r2=1337591&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java Sat May 12 16:51:02 2012 @@ -174,9 +174,19 @@ 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. + * + * @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