geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xuhaih...@apache.org
Subject svn commit: r1001340 - in /geronimo/server/trunk: framework/modules/geronimo-management/src/main/java/org/apache/geronimo/management/stats/ plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/stats/
Date Sun, 26 Sep 2010 02:10:21 GMT
Author: xuhaihong
Date: Sun Sep 26 02:10:21 2010
New Revision: 1001340

URL: http://svn.apache.org/viewvc?rev=1001340&view=rev
Log:
Update status method signature according to MBean changes in Tomcat

Modified:
    geronimo/server/trunk/framework/modules/geronimo-management/src/main/java/org/apache/geronimo/management/stats/WebModuleStatsImpl.java
    geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/stats/ConnectorStats.java
    geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/stats/ModuleStats.java

Modified: geronimo/server/trunk/framework/modules/geronimo-management/src/main/java/org/apache/geronimo/management/stats/WebModuleStatsImpl.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-management/src/main/java/org/apache/geronimo/management/stats/WebModuleStatsImpl.java?rev=1001340&r1=1001339&r2=1001340&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-management/src/main/java/org/apache/geronimo/management/stats/WebModuleStatsImpl.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-management/src/main/java/org/apache/geronimo/management/stats/WebModuleStatsImpl.java
Sun Sep 26 02:10:21 2010
@@ -25,7 +25,7 @@ import org.apache.geronimo.management.ge
 /**
  * Geronimo implementation of the JSR-77 style WebModule interface. This
  * is not required by JSR-77, but provides useful statistics for a web app
- * 
+ *
  * @version $Revison$ $Date$
  */
 public class WebModuleStatsImpl extends StatsImpl implements WebModuleStats {
@@ -131,7 +131,7 @@ public class WebModuleStatsImpl extends 
         this.sessionAliveTime.setTotalTime(totalTime);
     }
 
-    public void setSessionCount(int sessionCount) {
+    public void setSessionCount(long sessionCount) {
         this.sessionCount.setCount(sessionCount);
     }
 
@@ -139,14 +139,14 @@ public class WebModuleStatsImpl extends 
         this.activeSessionCount.setCount(activeSessionCount);
     }
 
-    public void setExpiredSessionCount(int expiredSessionCount) {
+    public void setExpiredSessionCount(long expiredSessionCount) {
         this.expiredSessionCount.setCount(expiredSessionCount);
     }
 
     public void setRejectedSessionCount(int rejectedSessionCount) {
         this.rejectedSessionCount.setCount(rejectedSessionCount);
     }
-    
+
     // Is this needed ?
     public void setLastSampleTime(long time) {
         sessionAliveTime.setLastSampleTime(time);

Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/stats/ConnectorStats.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/stats/ConnectorStats.java?rev=1001340&r1=1001339&r2=1001340&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/stats/ConnectorStats.java
(original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/stats/ConnectorStats.java
Sun Sep 26 02:10:21 2010
@@ -32,7 +32,7 @@ import org.apache.tomcat.util.modeler.Re
 
 /**
  * This will query MBeanServer and provide jsr77 Stats for connectors.
- * 
+ *
  * @version $Revision$ $Date$
  */
 public class ConnectorStats {
@@ -65,7 +65,7 @@ public class ConnectorStats {
         return stats;
 
     }
-    
+
     public Stats updateStats(String port) {
         updateStats(stats, port);
         return stats;
@@ -73,15 +73,15 @@ public class ConnectorStats {
     }
 
     private void updateStats(TomcatWebConnectorStatsImpl stats, String port) {
-        Iterator iterator;
-        Set set;
+        Iterator<ObjectInstance> iterator;
+        Set<ObjectInstance> set;
         ObjectName objectName;
         try {
             // Query Thread Pools
             set = mBeanServer.queryMBeans(tpName, null);
             iterator = set.iterator();
             while (iterator.hasNext()) {
-                ObjectInstance oi = (ObjectInstance) iterator.next();
+                ObjectInstance oi = iterator.next();
                 objectName = oi.getObjectName();
                 if (objectName.getKeyProperty("name").indexOf(port) > -1) {
                     tpName = objectName;
@@ -92,7 +92,7 @@ public class ConnectorStats {
             set = mBeanServer.queryMBeans(grpName, null);
             iterator = set.iterator();
             while (iterator.hasNext()) {
-                ObjectInstance oi = (ObjectInstance) iterator.next();
+                ObjectInstance oi = iterator.next();
                 objectName = oi.getObjectName();
                 if (objectName.getKeyProperty("name").indexOf(port) > -1) {
                     grpName = objectName;
@@ -109,7 +109,7 @@ public class ConnectorStats {
             long bytesSent = ((Long) (mBeanServer.getAttribute(grpName, "bytesSent"))).longValue();
             // Tomcat does not keep min Time, using 0 as Undefined value
             stats.setRequestTime(requestCount, 0, maxTime, processingTime);
-            stats.setErrorCount(errorCount);            
+            stats.setErrorCount(errorCount);
             stats.setBytesSentCount(bytesSent);
             stats.setBytesReceivedCount(bytesReceived);
             long openConnections = 0;
@@ -118,7 +118,7 @@ public class ConnectorStats {
             long maxOpenConnections = 0;
             //long maxOpenConnections = ((Long) (mBeanServer.getAttribute(grpName, "maxOpenConnections"))).longValue();
             stats.setOpenConnection(openConnections, maxOpenConnections, 0);
-            // ThreadPool 
+            // ThreadPool
             int currentThreadsBusy = ((Integer) (mBeanServer.getAttribute(tpName, "currentThreadsBusy"))).intValue();
             //stats.setActiveRequestCount(currentThreadsBusy); ??
             int currentThreadCount = ((Integer) (mBeanServer.getAttribute(tpName, "currentThreadCount"))).intValue();

Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/stats/ModuleStats.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/stats/ModuleStats.java?rev=1001340&r1=1001339&r2=1001340&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/stats/ModuleStats.java
(original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/stats/ModuleStats.java
Sun Sep 26 02:10:21 2010
@@ -34,7 +34,7 @@ import org.apache.geronimo.management.st
 
 /**
  * Query MBeanServer and provide jsr77 Stats for module, i.e. a webapp
- * 
+ *
  * @version $Revision$ $Date$
  */
 
@@ -60,16 +60,16 @@ public class ModuleStats {
             log.error("Error - " + ex.toString());
         }
         // Query Session Managers
-        Set set = mBeanServer.queryMBeans(mgrName, null);
-        Iterator iterator = set.iterator();
+        Set<ObjectInstance> set = mBeanServer.queryMBeans(mgrName, null);
+        Iterator<ObjectInstance> iterator = set.iterator();
         ObjectName objectName;
         while (iterator.hasNext()) {
-            ObjectInstance oi = (ObjectInstance) iterator.next();
+            ObjectInstance oi = iterator.next();
             objectName = oi.getObjectName();
             if (objectName.getKeyProperty("path").indexOf(context.getPath()) > -1) {
                 mgrName = objectName;
                 break;
-                
+
             }
         }
 
@@ -80,13 +80,13 @@ public class ModuleStats {
     }
 
     public Stats getStats() {
-        // Initialize startTime for all statistics 
+        // Initialize startTime for all statistics
         stats.setStartTime();
         // get transient statistics
         updateStats(stats);
         return stats;
     }
-    
+
     public Stats updateStats() {
         // get transient statistics
         updateStats(stats);
@@ -95,7 +95,7 @@ public class ModuleStats {
 
     /*
      * return updated value of all trainsient statistics
-     * 
+     *
      */
     private void updateStats(WebModuleStatsImpl stats) {
         stats.setLastSampleTime();
@@ -112,10 +112,10 @@ public class ModuleStats {
                     "activeSessions"))).intValue();
             int rejectedSessions = ((Integer) (mBeanServer.getAttribute(
                     mgrName, "rejectedSessions"))).intValue();
-            int expiredSessions = ((Integer) (mBeanServer.getAttribute(mgrName,
-                    "expiredSessions"))).intValue();
-            int sessionCounter = ((Integer) (mBeanServer.getAttribute(mgrName,
-                    "sessionCounter"))).intValue();
+            long expiredSessions = ((Long) (mBeanServer.getAttribute(mgrName,
+                    "expiredSessions"))).longValue();
+            long sessionCounter = ((Long) (mBeanServer.getAttribute(mgrName,
+                    "sessionCounter"))).longValue();
 
             stats.setSessionAliveTime(maxActive, -1, sessionMaxAliveTime,
                     sessionAverageAliveTime * maxActive);



Mime
View raw message