Expose current state of Lifecycle components via JMX beans (where a component has...
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Fri, 3 Sep 2010 09:48:46 +0000 (09:48 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Fri, 3 Sep 2010 09:48:46 +0000 (09:48 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@992245 13f79535-47bb-0310-9956-ffa450edef68

12 files changed:
java/org/apache/catalina/Lifecycle.java
java/org/apache/catalina/authenticator/mbeans-descriptors.xml
java/org/apache/catalina/connector/mbeans-descriptors.xml
java/org/apache/catalina/core/mbeans-descriptors.xml
java/org/apache/catalina/ha/session/mbeans-descriptors.xml
java/org/apache/catalina/ha/tcp/mbeans-descriptors.xml
java/org/apache/catalina/loader/WebappClassLoader.java
java/org/apache/catalina/loader/mbeans-descriptors.xml
java/org/apache/catalina/realm/mbeans-descriptors.xml
java/org/apache/catalina/session/mbeans-descriptors.xml
java/org/apache/catalina/util/LifecycleBase.java
java/org/apache/catalina/valves/mbeans-descriptors.xml

index f58d285..fe432e0 100644 (file)
@@ -287,4 +287,11 @@ public interface Lifecycle {
      * @return The current state of the source component.
      */
     public LifecycleState getState();
+    
+    
+    /**
+     * Obtain a textual representation of the current component state. Useful
+     * for JMX.
+     */
+    public String getStateName();
 }
index 4db6b9d..ef2a9c5 100644 (file)
@@ -23,7 +23,7 @@
          group="Valve"
          type="org.apache.catalina.authenticator.BasicAuthenticator">
     
-    <attribute   name="algorithm"
+    <attribute name="algorithm"
                description="The message digest algorithm to be used when generating session identifiers"
                type="java.lang.String"/>
       
@@ -31,7 +31,7 @@
                description="Should we cache authenticated Principals if the request is part of an HTTP session?"
                type="boolean"/>
       
-    <attribute   name="className"
+    <attribute name="className"
                description="Fully qualified class name of the managed object"
                type="java.lang.String"
                writeable="false"/>
     <attribute name="entropy"
                description="A String initialization parameter used to increase the  entropy of the initialization of our random number generator"
                type="java.lang.String"/>
+
+    <attribute name="stateName"
+               description="The name of the LifecycleState that this component is currently in"
+               type="java.lang.String"/>
   </mbean>
   
   
                description="Should we cache authenticated Principals if the request is part of an HTTP session?"
                type="boolean"/>
 
-    <attribute   name="className"
+    <attribute name="className"
                description="Fully qualified class name of the managed object"
                type="java.lang.String"
                writeable="false"/>
       
-    <attribute   name="entropy"
+    <attribute name="entropy"
                description="A String initialization parameter used to increase the  entropy of the initialization of our random number generator"
                type="java.lang.String"/>
+
+    <attribute name="stateName"
+               description="The name of the LifecycleState that this component is currently in"
+               type="java.lang.String"/>
   </mbean>
   
   <mbean name="FormAuthenticator"
          group="Valve"
          type="org.apache.catalina.authenticator.FormAuthenticator">
     
-    <attribute   name="algorithm"
+    <attribute name="algorithm"
                description="The message digest algorithm to be used when generating session identifiers"
                type="java.lang.String"/>
       
-    <attribute   name="cache"
+    <attribute name="cache"
                description="Should we cache authenticated Principals if the request is part of an HTTP session?"
                type="boolean"/>
 
-    <attribute   name="className"
+    <attribute name="className"
                description="Fully qualified class name of the managed object"
                type="java.lang.String"
                writeable="false"/>
 
-    <attribute   name="entropy"
+    <attribute name="entropy"
                description="A String initialization parameter used to increase the entropy of the initialization of our random number generator"
                type="java.lang.String"/>
+
+    <attribute name="stateName"
+               description="The name of the LifecycleState that this component is currently in"
+               type="java.lang.String"/>
   </mbean>
   
   <mbean name="NonLoginAuthenticator"
     <attribute name="entropy"
                description="A String initialization parameter used to increase the entropy of the initialization of our random number generator"
                type="java.lang.String"/>
+
+    <attribute name="stateName"
+               description="The name of the LifecycleState that this component is currently in"
+               type="java.lang.String"/>
   </mbean>
   
   
          group="Valve"
          type="org.apache.catalina.authenticator.SingleSignOn">
     
-    <attribute   name="className"
+    <attribute name="className"
                description="Fully qualified class name of the managed object"
                type="java.lang.String"
                writeable="false"/>
     <attribute name="cookieDomain"
                description="(Optiona) Domain to be used by sso cookies"
                type="java.lang.String" />
-      
+
+    <attribute name="stateName"
+               description="The name of the LifecycleState that this component is currently in"
+               type="java.lang.String"/>
   </mbean>
 
 
     <attribute name="entropy"
                description="A String initialization parameter used to increase the entropy of the initialization of our random number generator"
                type="java.lang.String"/>
+
+    <attribute name="stateName"
+               description="The name of the LifecycleState that this component is currently in"
+               type="java.lang.String"/>
   </mbean>
   
 </mbeans-descriptors>
index 0dbe579..e14960f 100644 (file)
           description="Comma-separated list of SSL protocol variants to be enabled"
                  type="java.lang.String"/>
                  
+    <attribute   name="stateName"
+          description="The name of the LifecycleState that this component is currently in"
+                 type="java.lang.String"/>
+
     <!-- Common -->
     <attribute   name="tcpNoDelay"
           description="Should we use TCP no delay?"
index 79dba71..622d697 100644 (file)
                is="true"
                type="boolean"
                writeable="false" />         
+
+    <attribute name="stateName"
+               description="The name of the LifecycleState that this component is currently in"
+               type="java.lang.String"/>
           
     <attribute name="staticResources"
                description="Static resources associated with the context."
                description="Fully qualified class name of the managed object"
                type="java.lang.String"
                writeable="false"/>               
-      
+
+    <attribute name="stateName"
+               description="The name of the LifecycleState that this component is currently in"
+               type="java.lang.String"/>      
   </mbean>
   
   <mbean name="StandardEngine"
     <attribute name="startChildren"
                description="Will children be started automatically when they are added."
                type="boolean"/>  
+
+    <attribute name="stateName"
+               description="The name of the LifecycleState that this component is currently in"
+               type="java.lang.String"/>
                
     <attribute name="valveObjectNames"
                description="ObjectNames for the valves associated with this container"
                description="Fully qualified class name of the managed object"
                type="java.lang.String"
                writeable="false"/>
-      
+
+    <attribute name="stateName"
+               description="The name of the LifecycleState that this component is currently in"
+               type="java.lang.String"/>
   </mbean>
   
   <mbean name="StandardHost"
     <attribute name="startChildren"
                description="Will children be started automatically when they are added?"
                type="boolean"/>            
+
+    <attribute name="stateName"
+               description="The name of the LifecycleState that this component is currently in"
+               type="java.lang.String"/>
       
     <attribute name="unpackWARs"
                description="Unpack WARs property"
                type="java.lang.String"
                writeable="false"/>
 
+    <attribute name="stateName"
+               description="The name of the LifecycleState that this component is currently in"
+               type="java.lang.String"/>
   </mbean>
 
   <mbean name="StandardServer"
     <attribute name="shutdown"
                description="Shutdown password"
                type="java.lang.String"/>
+
+    <attribute name="stateName"
+               description="The name of the LifecycleState that this component is currently in"
+               type="java.lang.String"/>
    
     <operation name="await"
                description="Wait for the shutdown message"
                type="javax.management.ObjectName"
                writeable="false" />
 
+    <attribute name="stateName"
+               description="The name of the LifecycleState that this component is currently in"
+               type="java.lang.String"/>
+
     <operation name="addConnector"
                description="Add a new connector"
                impact="ACTION"
                description="Number of tasks waiting to be processed"
                type="int"
           writeable="false" />
+
+    <attribute name="stateName"
+               description="The name of the LifecycleState that this component is currently in"
+               type="java.lang.String"/>
                
     <attribute name="threadPriority"
                description="The thread priority for threads in this thread pool"
                type="boolean"
                writeable="false"/>
 
+    <attribute name="stateName"
+               description="The name of the LifecycleState that this component is currently in"
+               type="java.lang.String"/>
+
     <attribute name="statisticsProvider"
                description="Performance statistics support for this managed object"
                is="true"
                 description="Fully qualified class name of the managed object"
                 type="java.lang.String"
                 writeable="false"/>  
-                    
+
+    <attribute name="stateName"
+               description="The name of the LifecycleState that this component is currently in"
+               type="java.lang.String"/>
   </mbean>
 
 </mbeans-descriptors>
index 8c73b7e..68c3816 100644 (file)
@@ -50,6 +50,9 @@
       name="sessionIdAttribute"
       description="Name of attribute with sessionid value before turnover a session"
       type="java.lang.String"/>
+    <attribute name="stateName"
+      description="The name of the LifecycleState that this component is currently in"
+      type="java.lang.String"/>
     <operation
       name="start"
       description="Stops the Cluster JvmRouteBinderValve"
       description="Total number of replaced sessions that load from external nodes"
       type="long"
       writeable="false"/>
+    <attribute name="stateName"
+      description="The name of the LifecycleState that this component is currently in"
+      type="java.lang.String"/>
     <attribute
       name="stateTransfered"
       is="true"
       name="sessionMaxAliveTime"
       description="Longest time an expired session had been alive"
       type="int"/>
+    <attribute name="stateName"
+      description="The name of the LifecycleState that this component is currently in"
+      type="java.lang.String"/>
     <attribute
       name="randomFile"
       description="File source of random - /dev/urandom or a pipe"
index 7e34065..7bea222 100644 (file)
       description="notify lifecycleListener from message transfer failure"
       is="true"
       type="boolean"/>
+    <attribute
+      name="stateName"
+      description="The name of the LifecycleState that this component is currently in"
+      type="java.lang.String"/>
     <operation
       name="setProperty"
       description="set a property to all cluster managers (with prefix 'manager.')"
       description="Request attribute name to indicate that request processing is at primary session node"
       type="java.lang.String"/>
     <attribute
+      name="stateName"
+      description="The name of the LifecycleState that this component is currently in"
+      type="java.lang.String"/>
+    <attribute
       name="totalSendTime"
       description="total replicated send time"
       type="long"
index 2b9a6c0..a90a3a8 100644 (file)
@@ -1807,6 +1807,15 @@ public class WebappClassLoader
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String getStateName() {
+        return getState().toString();
+    }
+
+
     @Override
     public void init() {
         // NOOP
index bd78294..65bbee4 100644 (file)
              writeable="false" 
                  type="java.lang.String"/>
 
+    <attribute   name="stateName"
+          description="The name of the LifecycleState that this component is currently in"
+                 type="java.lang.String"/>
+
     <attribute   name="loaderRepositories"
           description="Repositories set in the real loader"
                  type="[Ljava.lang.String;"
              writeable="false" 
                  type="java.lang.String"/>
 
+    <attribute   name="stateName"
+          description="The name of the LifecycleState that this component is currently in"
+                 type="java.lang.String"/>
+
     <attribute   name="loaderRepositories"
           description="Repositories set in the real loader"
                  type="[Ljava.lang.String;"
           description="The searchExternalFirst flag for this Loader"
                  type="boolean"/>
 
+    <attribute   name="stateName"
+          description="The name of the LifecycleState that this component is currently in"
+                 type="java.lang.String"/>
+
     <attribute   name="URLs"
           description="The URLs of this loader"
                  type="[Ljava.net.URL;"/>
index ce4c6f2..19dfde9 100644 (file)
           description="The column in the user role table that names a role"
                  type="java.lang.String"/>
 
+    <attribute   name="stateName"
+          description="The name of the LifecycleState that this component is currently in"
+                 type="java.lang.String"/>
+
     <attribute   name="userCredCol"
           description="The column in the user table that holds the user's credentials"
                  type="java.lang.String"/>
           description="The realm path"
                  type="java.lang.String"/>
 
+    <attribute   name="stateName"
+          description="The name of the LifecycleState that this component is currently in"
+                 type="java.lang.String"/>
+
     <attribute   name="userClassNames"
           description="Comma-delimited list of javax.security.Principal classes that represent individual users"
                  type="java.lang.String"/>
           description="The realm path"
                  type="java.lang.String"/>
 
+    <attribute   name="stateName"
+          description="The name of the LifecycleState that this component is currently in"
+                 type="java.lang.String"/>
+
     <attribute   name="userCredCol"
           description="The column in the user table that holds the user's credentials"
                  type="java.lang.String"/>
           description="Should we search the entire subtree for matching memberships?"
                  type="boolean"/>
 
+    <attribute   name="stateName"
+          description="The name of the LifecycleState that this component is currently in"
+                 type="java.lang.String"/>
+
     <attribute   name="userBase"
           description="The base element for user searches"
                  type="java.lang.String"/>
           description="The realm path"
                  type="java.lang.String"/>
 
+    <attribute   name="stateName"
+          description="The name of the LifecycleState that this component is currently in"
+                 type="java.lang.String"/>
+
     <attribute   name="validate"
           description="The 'validate certificate chains' flag."
                  type="boolean"/>
           description="The realm path"
                  type="java.lang.String"/>
 
+    <attribute   name="stateName"
+          description="The name of the LifecycleState that this component is currently in"
+                 type="java.lang.String"/>
+
     <attribute   name="validate"
           description="The 'validate certificate chains' flag."
                  type="boolean"/>
           description="The realm path"
                  type="java.lang.String"/>
 
+    <attribute   name="stateName"
+          description="The name of the LifecycleState that this component is currently in"
+                 type="java.lang.String"/>
+
     <attribute   name="validate"
           description="The 'validate certificate chains' flag."
                  type="boolean"/>
index 510fb1a..464b546 100644 (file)
           description="Longest time an expired session had been alive"
                  type="int" />
                  
+    <attribute   name="stateName"
+          description="The name of the LifecycleState that this component is currently in"
+                 type="java.lang.String"/>
+
     <attribute   name="randomFile"
           description="File source of random - /dev/urandom or a pipe"
                  type="java.lang.String"/>
           description="Longest time an expired session had been alive"
                  type="int" />
                  
+    <attribute   name="stateName"
+          description="The name of the LifecycleState that this component is currently in"
+                 type="java.lang.String"/>
+
     <attribute   name="randomFile"
           description="File source of random - /dev/urandom or a pipe"
                  type="java.lang.String"/>
index 0d5ccab..b1850c6 100644 (file)
@@ -286,6 +286,15 @@ public abstract class LifecycleBase implements Lifecycle {
 
 
     /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String getStateName() {
+        return getState().toString();
+    }
+
+
+    /**
      * Provides a mechanism for sub-classes to update the component state.
      * Calling this method will automatically fire any associated
      * {@link Lifecycle} event.
index ea60cd7..bf8b3b5 100644 (file)
                is="true"
                type="boolean"/>
 
+    <attribute name="stateName"
+               description="The name of the LifecycleState that this component is currently in"
+               type="java.lang.String"/>
+
     <attribute name="suffix"
                description="The suffix that is added to log file filenames"
                type="java.lang.String"/>
                type="java.lang.String"
                writeable="false"/>
 
+    <attribute name="stateName"
+               description="The name of the LifecycleState that this component is currently in"
+               type="java.lang.String"/>
+
   </mbean>
 
   <mbean name="ExtendedAccessLogValve"
                description="Should this be blocked interruptibly until a permit is availabl?"
                type="boolean"/>
                
+    <attribute name="stateName"
+               description="The name of the LifecycleState that this component is currently in"
+               type="java.lang.String"/>
+
   </mbean>
 
   <mbean name="RemoteAddrValve"
                type="java.lang.String"
                writeable="false"/>
 
+    <attribute name="stateName"
+               description="The name of the LifecycleState that this component is currently in"
+               type="java.lang.String"/>
+
   </mbean>
 
   <mbean name="RemoteHostValve"
                type="java.lang.String"
                writeable="false"/>
 
+    <attribute name="stateName"
+               description="The name of the LifecycleState that this component is currently in"
+               type="java.lang.String"/>
+
   </mbean>
 
   <mbean name="RemoteIpValve"
                type="java.lang.String"
                writeable="false" />
                
+    <attribute name="stateName"
+               description="The name of the LifecycleState that this component is currently in"
+               type="java.lang.String"/>
+
     <attribute name="trustedProxies"
                description="Comma delimited list of trusted proxies"
                type="java.lang.String"