Add getLastAccessedTimestamp and getCreationTimestamp for remote JMX Access.
authorpero <pero@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 17 Jan 2008 20:43:43 +0000 (20:43 +0000)
committerpero <pero@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 17 Jan 2008 20:43:43 +0000 (20:43 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@612971 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/ha/session/mbeans-descriptors.xml
java/org/apache/catalina/session/ManagerBase.java
java/org/apache/catalina/session/mbeans-descriptors.xml
webapps/docs/changelog.xml

index 7fed3b2..4da1d84 100644 (file)
@@ -342,6 +342,22 @@ created by this Manager"
         description="Id of the session"
         type="java.lang.String"/>
     </operation>
+    <operation   name="getLastAccessedTimestamp"
+          description="Get the last access timestamp"
+               impact="ACTION"
+           returnType="long">
+      <parameter name="sessionId"
+          description="Id of the session"
+                 type="java.lang.String"/>
+    </operation>
+    <operation   name="getCreationTimestamp"
+          description="Get the creation timestamp"
+               impact="ACTION"
+           returnType="long">
+      <parameter name="sessionId"
+          description="Id of the session"
+                 type="java.lang.String"/>
+    </operation>
     <operation
       name="expireAllLocalSessions"
       description="Exipre all active local sessions and replicate the invalid sessions"
index 9f3c131..f528716 100644 (file)
@@ -1203,7 +1203,13 @@ public abstract class ManagerBase implements Manager, MBeanRegistration {
         s.expire();
     }
 
-
+    public long getLastAccessedTimestamp( String sessionId ) {
+        Session s=(Session)sessions.get(sessionId);
+        if(s== null)
+            return -1 ;
+        return s.getLastAccessedTime();
+    }
+  
     public String getLastAccessedTime( String sessionId ) {
         Session s=(Session)sessions.get(sessionId);
         if( s==null ) {
@@ -1224,6 +1230,13 @@ public abstract class ManagerBase implements Manager, MBeanRegistration {
         return new Date(s.getCreationTime()).toString();
     }
 
+    public long getCreationTimestamp( String sessionId ) {
+        Session s=(Session)sessions.get(sessionId);
+        if(s== null)
+            return -1 ;
+        return s.getCreationTime();
+    }
+
     // -------------------- JMX and Registration  --------------------
     protected String domain;
     protected ObjectName oname;
index 2d0692f..20fe96a 100644 (file)
                  type="java.lang.String"/>
     </operation>
 
+   <operation   name="getLastAccessedTimestamp"
+          description="Get the last access timestamp"
+               impact="ACTION"
+           returnType="long">
+      <parameter name="sessionId"
+          description="Id of the session"
+                 type="java.lang.String"/>
+    </operation>
+
+    <operation   name="getCreationTimestamp"
+          description="Get the creation timestamp"
+               impact="ACTION"
+           returnType="long">
+      <parameter name="sessionId"
+          description="Id of the session"
+                 type="java.lang.String"/>
+    </operation>
+
   </mbean>
 
   <mbean         name="PersistentManager"
                  type="java.lang.String"/>
     </operation>
 
+    <operation   name="getLastAccessedTimestamp"
+          description="Get the last access timestamp"
+               impact="ACTION"
+           returnType="long">
+      <parameter name="sessionId"
+          description="Id of the session"
+                 type="java.lang.String"/>
+    </operation>
+
+    <operation   name="getCreationTimestamp"
+          description="Get the creation timestamp"
+               impact="ACTION"
+           returnType="long">
+      <parameter name="sessionId"
+          description="Id of the session"
+                 type="java.lang.String"/>
+    </operation>
+
   </mbean>
 
 </mbeans-descriptors>
index fe0049d..e3384c3 100644 (file)
   </subsection>
   <subsection name="Catalina">
     <changelog>
+      <add>
+        Add ManagerBase session getLastAccessedTimestamp and getCreationTimestamp for better
+        remote JMX access. (pero)
+      </add>
       <fix>
         Set correct StandardManager.sessionCounter after reload/restart. (pero)
       </fix>