tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rj...@apache.org
Subject svn commit: r1065767 - in /tomcat/sandbox/tomcat-oacc/trunk: docs/changelog.xml src/share/org/apache/catalina/cluster/session/DeltaManager.java
Date Mon, 31 Jan 2011 20:45:32 GMT
Author: rjung
Date: Mon Jan 31 20:45:31 2011
New Revision: 1065767

URL: http://svn.apache.org/viewvc?rev=1065767&view=rev
Log:
Add session creation / expiration rate statistics to the session managers.

Backport of r1036595 from trunk, resp. r1061433 from TC6.

Modified:
    tomcat/sandbox/tomcat-oacc/trunk/docs/changelog.xml
    tomcat/sandbox/tomcat-oacc/trunk/src/share/org/apache/catalina/cluster/session/DeltaManager.java

Modified: tomcat/sandbox/tomcat-oacc/trunk/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-oacc/trunk/docs/changelog.xml?rev=1065767&r1=1065766&r2=1065767&view=diff
==============================================================================
--- tomcat/sandbox/tomcat-oacc/trunk/docs/changelog.xml (original)
+++ tomcat/sandbox/tomcat-oacc/trunk/docs/changelog.xml Mon Jan 31 20:45:31 2011
@@ -31,6 +31,10 @@
 <body>
 <section name="Tomcat OACC 0.1 (rjung)">
   <subsection name="Cluster">
+      <add>
+        Provide session creation and destruction rate metrics in the session
+        managers. (rjung)
+      </add>
       <fix>
         <bug>50600</bug>: Prevent a <code>ConcurrentModificationException</code>
         when removing a WAR file via the FarmWarDeployer. (rjung)

Modified: tomcat/sandbox/tomcat-oacc/trunk/src/share/org/apache/catalina/cluster/session/DeltaManager.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/tomcat-oacc/trunk/src/share/org/apache/catalina/cluster/session/DeltaManager.java?rev=1065767&r1=1065766&r2=1065767&view=diff
==============================================================================
--- tomcat/sandbox/tomcat-oacc/trunk/src/share/org/apache/catalina/cluster/session/DeltaManager.java
(original)
+++ tomcat/sandbox/tomcat-oacc/trunk/src/share/org/apache/catalina/cluster/session/DeltaManager.java
Mon Jan 31 20:45:31 2011
@@ -25,6 +25,7 @@ import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
+import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.Iterator;
@@ -43,6 +44,7 @@ import org.apache.catalina.cluster.Catal
 import org.apache.catalina.cluster.ClusterMessage;
 import org.apache.catalina.cluster.Member;
 import org.apache.catalina.cluster.tcp.ReplicationValve;
+import org.apache.catalina.session.ManagerBase;
 import org.apache.catalina.util.CustomObjectInputStream;
 import org.apache.catalina.util.LifecycleSupport;
 import org.apache.catalina.util.StringManager;
@@ -140,6 +142,7 @@ public class DeltaManager extends Cluste
     private boolean receiverQueue = false ;
     private boolean stateTimestampDrop = true ;
     private long stateTransferCreateSendTime; 
+    private boolean hasSessionCreateStatistics = false;
     
     // ------------------------------------------------------------------ stats attributes
     
@@ -168,6 +171,17 @@ public class DeltaManager extends Cluste
     // ------------------------------------------------------------- Constructor
     public DeltaManager() {
         super();
+        /* Check for TC 6.0.27+ API */
+        Class<?> clazz = super.getClass();
+        try {
+            Method method = clazz.getDeclaredMethod("getSessionCreateRate",
+                    new Class[] {});
+            hasSessionCreateStatistics = true;
+        } catch (NoSuchMethodException e) {
+             // IGNORE
+        } catch (SecurityException e) {
+             // IGNORE
+        }
     }
 
     // ------------------------------------------------------------- Properties
@@ -1377,6 +1391,18 @@ public class DeltaManager extends Cluste
     public synchronized void resetStatistics() {
         processingTime = 0 ;
         expiredSessions = 0 ;
+        if (hasSessionCreateStatistics) {
+            sessionCreationTiming.clear();
+            while (sessionCreationTiming.size() <
+                    ManagerBase.TIMING_STATS_CACHE_SIZE) {
+                sessionCreationTiming.add(null);
+            }
+            sessionExpirationTiming.clear();
+            while (sessionExpirationTiming.size() <
+                    ManagerBase.TIMING_STATS_CACHE_SIZE) {
+                sessionExpirationTiming.add(null);
+            }
+        }
         rejectedSessions = 0 ;
         sessionReplaceCounter = 0 ;
         counterNoStateTransfered = 0 ;



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


Mime
View raw message