[jboss-cvs] JBossAS SVN: r71542 - in trunk/connector/src/main/org/jboss/resource/statistic: pool and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Apr 1 05:43:36 EDT 2008


Author: adrian at jboss.org
Date: 2008-04-01 05:43:35 -0400 (Tue, 01 Apr 2008)
New Revision: 71542

Added:
   trunk/connector/src/main/org/jboss/resource/statistic/JBossConnectionStatistics.java
Modified:
   trunk/connector/src/main/org/jboss/resource/statistic/pool/JBossDefaultSubPoolStatisticFormatter.java
   trunk/connector/src/main/org/jboss/resource/statistic/pool/JBossManagedConnectionPoolStatistics.java
   trunk/connector/src/main/org/jboss/resource/statistic/pool/JBossSubPoolStatistics.java
Log:
Port statistics from 4.2.x

Added: trunk/connector/src/main/org/jboss/resource/statistic/JBossConnectionStatistics.java
===================================================================
--- trunk/connector/src/main/org/jboss/resource/statistic/JBossConnectionStatistics.java	                        (rev 0)
+++ trunk/connector/src/main/org/jboss/resource/statistic/JBossConnectionStatistics.java	2008-04-01 09:43:35 UTC (rev 71542)
@@ -0,0 +1,40 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt in the distribution for a
+  * full listing of individual contributors.
+  *
+  * This is free software; you can redistribute it and/or modify it
+  * under the terms of the GNU Lesser General Public License as
+  * published by the Free Software Foundation; either version 2.1 of
+  * the License, or (at your option) any later version.
+  *
+  * This software is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  * Lesser General Public License for more details.
+  *
+  * You should have received a copy of the GNU Lesser General Public
+  * License along with this software; if not, write to the Free
+  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+  */
+package org.jboss.resource.statistic;
+
+
+/**
+ * A JBossConnectionStatistics.
+ * 
+ * @author <a href="vicky.kak at jboss.com">Vicky Kak</a>
+ *
+ */
+public interface JBossConnectionStatistics
+{	
+	/**
+	 * This retrieves the connection statistics for the underlying 
+	 * connection of ManagedConnection.
+	 * 
+	 * @return the statistics.
+	 */
+	public Object listConnectionStats();
+}

Modified: trunk/connector/src/main/org/jboss/resource/statistic/pool/JBossDefaultSubPoolStatisticFormatter.java
===================================================================
--- trunk/connector/src/main/org/jboss/resource/statistic/pool/JBossDefaultSubPoolStatisticFormatter.java	2008-04-01 09:24:21 UTC (rev 71541)
+++ trunk/connector/src/main/org/jboss/resource/statistic/pool/JBossDefaultSubPoolStatisticFormatter.java	2008-04-01 09:43:35 UTC (rev 71542)
@@ -85,7 +85,7 @@
          
       }
       
-      final ManagedConnectionPoolStatistics poolStats = (ManagedConnectionPoolStatistics)stats;
+      final ManagedConnectionPoolStatistics poolStats = (ManagedConnectionPoolStatistics)stats;      
       return formatSubPoolStatistics(poolStats);
       
    }

Modified: trunk/connector/src/main/org/jboss/resource/statistic/pool/JBossManagedConnectionPoolStatistics.java
===================================================================
--- trunk/connector/src/main/org/jboss/resource/statistic/pool/JBossManagedConnectionPoolStatistics.java	2008-04-01 09:24:21 UTC (rev 71541)
+++ trunk/connector/src/main/org/jboss/resource/statistic/pool/JBossManagedConnectionPoolStatistics.java	2008-04-01 09:43:35 UTC (rev 71542)
@@ -74,7 +74,6 @@
    }
    
    public void addSubPool(final JBossSubPoolStatistics subPool){
-       
       subPools.add(subPool);
    }
    
@@ -227,7 +226,29 @@
    public void addSubPool(JBossStatistics subPool)
    {
       // TODO Auto-generated method stub
-      
+	   subPools.add(subPool);
    }   
    
+   public String toString()
+   {
+	   StringBuffer poolStatBuff = new StringBuffer(); 
+	   poolStatBuff.append(" Sub Pool Statistics:");
+	   poolStatBuff.append("\n Sub Pool Count:"+subPools.size()); 
+	   poolStatBuff.append("\n\n---------------------------------------------------------------");
+	   for(Iterator iter = subPools.iterator(); iter.hasNext();)
+	   {		   
+         JBossSubPoolStatistics statGroup = (JBossSubPoolStatistics)iter.next();
+         poolStatBuff.append("\n Track By Transaction:" + statGroup.getTrackByTxn()); 
+         poolStatBuff.append("\n Available Connections Count:" + statGroup.getAvailableConnections());
+         poolStatBuff.append("\n Max Connections In Use Count:" + statGroup.getMaxConnectionsInUse());
+         poolStatBuff.append("\n Connections Destroyed Count:" + statGroup.getConnectionsDestroyed());
+         poolStatBuff.append("\n Connections In Use Count:" + statGroup.getConnectionsInUse());
+         poolStatBuff.append("\n Total Block Time:" + statGroup.getTotalBlockTime());
+         poolStatBuff.append("\n Average Block Time For Sub Pool:" + statGroup.getAverageBlockTime());
+         poolStatBuff.append("\n Maximum Wait Time For Sub Pool:" + statGroup.getMaxWaitTime());
+         poolStatBuff.append("\n Total Timed Out Connections:" + statGroup.getTotalTimedOut());
+         poolStatBuff.append("\n\n ---------------------------------------------------------------");
+	   }
+	   return poolStatBuff.toString();
+   }
 }

Modified: trunk/connector/src/main/org/jboss/resource/statistic/pool/JBossSubPoolStatistics.java
===================================================================
--- trunk/connector/src/main/org/jboss/resource/statistic/pool/JBossSubPoolStatistics.java	2008-04-01 09:24:21 UTC (rev 71541)
+++ trunk/connector/src/main/org/jboss/resource/statistic/pool/JBossSubPoolStatistics.java	2008-04-01 09:43:35 UTC (rev 71542)
@@ -59,6 +59,9 @@
    /** The totalTimedOut */
    private int totalTimedOut;
    
+   /** The maxWaitTime */
+   private long maxWaitTime;
+
    /**
     * Get the availableConnections.
     * 
@@ -178,8 +181,9 @@
       statBuff.append("Connections Destroyed Count:" + getConnectionsDestroyed() + "\n");
       statBuff.append("Connections In Use Count:" + getConnectionsInUse() + "\n");
       statBuff.append("Total Block Time:" + getTotalBlockTime() + "\n");
-      statBuff.append("Average Block Time For Sub Pool:" + getTotalBlockTime() + "\n");
-
+      statBuff.append("Average Block Time For Sub Pool:" + getAverageBlockTime() + "\n");
+      statBuff.append("Maximum Wait Time For Sub Pool:" + getMaxWaitTime() + "\n");
+      
       statBuff.append("Total Timed Out:" + getTotalTimedOut() + "\n");
 
       return statBuff.toString();
@@ -251,4 +255,24 @@
       this.averageBlockTime = averageBlockTime;
    }
    
+   /**
+    * Get the maxWaitTime.
+    * 
+    * @return the maxWaitTime.
+    */
+   public long getMaxWaitTime()
+   {
+      return maxWaitTime;
+   }
+
+   /**
+    * Set the maxWaitTime.
+    * 
+    * @param maxWaitTime The averageBlockTime to set.
+    */
+   public void setMaxWaitTime(long maxWaitTime)
+   {
+      this.maxWaitTime = maxWaitTime;
+   }
+   
 }




More information about the jboss-cvs-commits mailing list