[jboss-cvs] JBossAS SVN: r111121 - in projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool: mcp and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Apr 7 14:36:33 EDT 2011
Author: jesper.pedersen
Date: 2011-04-07 14:36:33 -0400 (Thu, 07 Apr 2011)
New Revision: 111121
Modified:
projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/SubPoolStatistics.java
projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/mcp/ManagedConnectionPoolStatisticsImpl.java
Log:
[JBJCA-542] Only collect/show statistics if enabled
Modified: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/SubPoolStatistics.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/SubPoolStatistics.java 2011-04-07 16:21:56 UTC (rev 111120)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/SubPoolStatistics.java 2011-04-07 18:36:33 UTC (rev 111121)
@@ -212,14 +212,19 @@
*/
public int getActiveCount()
{
- int result = 0;
+ if (isEnabled())
+ {
+ int result = 0;
- for (SubPoolContext spc : subPools.values())
- {
- result += spc.getSubPool().getStatistics().getActiveCount();
+ for (SubPoolContext spc : subPools.values())
+ {
+ result += spc.getSubPool().getStatistics().getActiveCount();
+ }
+
+ return result;
}
- return result;
+ return 0;
}
/**
@@ -227,7 +232,10 @@
*/
public long getAverageBlockingTime()
{
- return getCreatedCount() != 0 ? getTotalBlockingTime() / getCreatedCount() : 0;
+ if (isEnabled())
+ return getCreatedCount() != 0 ? getTotalBlockingTime() / getCreatedCount() : 0;
+
+ return 0;
}
/**
@@ -235,14 +243,19 @@
*/
public int getCreatedCount()
{
- int result = 0;
+ if (isEnabled())
+ {
+ int result = 0;
- for (SubPoolContext spc : subPools.values())
- {
- result += spc.getSubPool().getStatistics().getCreatedCount();
+ for (SubPoolContext spc : subPools.values())
+ {
+ result += spc.getSubPool().getStatistics().getCreatedCount();
+ }
+
+ return result;
}
- return result;
+ return 0;
}
/**
@@ -250,14 +263,19 @@
*/
public int getDestroyedCount()
{
- int result = 0;
+ if (isEnabled())
+ {
+ int result = 0;
- for (SubPoolContext spc : subPools.values())
- {
- result += spc.getSubPool().getStatistics().getDestroyedCount();
+ for (SubPoolContext spc : subPools.values())
+ {
+ result += spc.getSubPool().getStatistics().getDestroyedCount();
+ }
+
+ return result;
}
- return result;
+ return 0;
}
/**
@@ -265,16 +283,21 @@
*/
public long getMaxWaitTime()
{
- long result = Long.MIN_VALUE;
+ if (isEnabled())
+ {
+ long result = Long.MIN_VALUE;
- for (SubPoolContext spc : subPools.values())
- {
- long v = spc.getSubPool().getStatistics().getMaxWaitTime();
- if (v > result)
- result = v;
+ for (SubPoolContext spc : subPools.values())
+ {
+ long v = spc.getSubPool().getStatistics().getMaxWaitTime();
+ if (v > result)
+ result = v;
+ }
+
+ return result != Long.MIN_VALUE ? result : 0;
}
- return result != Long.MIN_VALUE ? result : 0;
+ return 0;
}
/**
@@ -282,14 +305,19 @@
*/
public int getTimedOut()
{
- int result = 0;
+ if (isEnabled())
+ {
+ int result = 0;
- for (SubPoolContext spc : subPools.values())
- {
- result += spc.getSubPool().getStatistics().getTimedOut();
+ for (SubPoolContext spc : subPools.values())
+ {
+ result += spc.getSubPool().getStatistics().getTimedOut();
+ }
+
+ return result;
}
- return result;
+ return 0;
}
/**
@@ -297,14 +325,19 @@
*/
public long getTotalBlockingTime()
{
- long result = 0;
+ if (isEnabled())
+ {
+ long result = 0;
- for (SubPoolContext spc : subPools.values())
- {
- result += spc.getSubPool().getStatistics().getTotalBlockingTime();
+ for (SubPoolContext spc : subPools.values())
+ {
+ result += spc.getSubPool().getStatistics().getTotalBlockingTime();
+ }
+
+ return result;
}
- return result;
+ return 0;
}
/**
Modified: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/mcp/ManagedConnectionPoolStatisticsImpl.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/mcp/ManagedConnectionPoolStatisticsImpl.java 2011-04-07 16:21:56 UTC (rev 111120)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/connectionmanager/pool/mcp/ManagedConnectionPoolStatisticsImpl.java 2011-04-07 18:36:33 UTC (rev 111121)
@@ -215,7 +215,10 @@
*/
public int getActiveCount()
{
- return createdCount.get() - destroyedCount.get();
+ if (isEnabled())
+ return createdCount.get() - destroyedCount.get();
+
+ return 0;
}
/**
@@ -223,7 +226,10 @@
*/
public long getAverageBlockingTime()
{
- return createdCount.get() != 0 ? totalBlockingTime.get() / createdCount.get() : 0;
+ if (isEnabled())
+ return createdCount.get() != 0 ? totalBlockingTime.get() / createdCount.get() : 0;
+
+ return 0;
}
/**
@@ -231,7 +237,10 @@
*/
public int getCreatedCount()
{
- return createdCount.get();
+ if (isEnabled())
+ return createdCount.get();
+
+ return 0;
}
/**
@@ -239,7 +248,8 @@
*/
public void deltaCreatedCount()
{
- createdCount.incrementAndGet();
+ if (isEnabled())
+ createdCount.incrementAndGet();
}
/**
@@ -247,7 +257,10 @@
*/
public int getDestroyedCount()
{
- return destroyedCount.get();
+ if (isEnabled())
+ return destroyedCount.get();
+
+ return 0;
}
/**
@@ -255,7 +268,8 @@
*/
public void deltaDestroyedCount()
{
- destroyedCount.incrementAndGet();
+ if (isEnabled())
+ destroyedCount.incrementAndGet();
}
/**
@@ -263,7 +277,10 @@
*/
public long getMaxWaitTime()
{
- return maxWaitTime.get() != Long.MIN_VALUE ? maxWaitTime.get() : 0;
+ if (isEnabled())
+ return maxWaitTime.get() != Long.MIN_VALUE ? maxWaitTime.get() : 0;
+
+ return 0;
}
/**
@@ -271,7 +288,10 @@
*/
public int getTimedOut()
{
- return timedOut.get();
+ if (isEnabled())
+ return timedOut.get();
+
+ return 0;
}
/**
@@ -279,7 +299,8 @@
*/
public void deltaTimedOut()
{
- timedOut.incrementAndGet();
+ if (isEnabled())
+ timedOut.incrementAndGet();
}
/**
@@ -287,7 +308,10 @@
*/
public long getTotalBlockingTime()
{
- return totalBlockingTime.get();
+ if (isEnabled())
+ return totalBlockingTime.get();
+
+ return 0;
}
/**
@@ -296,10 +320,13 @@
*/
public void deltaTotalBlockingTime(long delta)
{
- totalBlockingTime.addAndGet(delta);
+ if (isEnabled())
+ {
+ totalBlockingTime.addAndGet(delta);
- if (delta > maxWaitTime.get())
- maxWaitTime.set(delta);
+ if (delta > maxWaitTime.get())
+ maxWaitTime.set(delta);
+ }
}
/**
More information about the jboss-cvs-commits
mailing list