Author: markt
Date: Fri Sep  3 09:48:46 2010
New Revision: 992245

URL: http://svn.apache.org/viewvc?rev=992245&view=rev
Log:
Expose current state of Lifecycle components via JMX beans (where a component 
has one). Mainly useful for monitoring web application status.

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

Modified: tomcat/trunk/java/org/apache/catalina/Lifecycle.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/Lifecycle.java?rev=992245&r1=992244&r2=992245&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/Lifecycle.java (original)
+++ tomcat/trunk/java/org/apache/catalina/Lifecycle.java Fri Sep  3 09:48:46 
2010
@@ -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();
 }

Modified: 
tomcat/trunk/java/org/apache/catalina/authenticator/mbeans-descriptors.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/authenticator/mbeans-descriptors.xml?rev=992245&r1=992244&r2=992245&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/authenticator/mbeans-descriptors.xml 
(original)
+++ tomcat/trunk/java/org/apache/catalina/authenticator/mbeans-descriptors.xml 
Fri Sep  3 09:48:46 2010
@@ -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"/>
@@ -39,6 +39,10 @@
     <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>
   
   
@@ -56,14 +60,18 @@
                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"
@@ -72,22 +80,26 @@
          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"
@@ -112,6 +124,10 @@
     <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>
   
   
@@ -121,7 +137,7 @@
          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"/>
@@ -133,7 +149,10 @@
     <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>
 
 
@@ -159,6 +178,10 @@
     <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>

Modified: tomcat/trunk/java/org/apache/catalina/connector/mbeans-descriptors.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/mbeans-descriptors.xml?rev=992245&r1=992244&r2=992245&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/connector/mbeans-descriptors.xml 
(original)
+++ tomcat/trunk/java/org/apache/catalina/connector/mbeans-descriptors.xml Fri 
Sep  3 09:48:46 2010
@@ -145,6 +145,10 @@
           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?"

Modified: tomcat/trunk/java/org/apache/catalina/core/mbeans-descriptors.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/mbeans-descriptors.xml?rev=992245&r1=992244&r2=992245&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/mbeans-descriptors.xml (original)
+++ tomcat/trunk/java/org/apache/catalina/core/mbeans-descriptors.xml Fri Sep  
3 09:48:46 2010
@@ -324,6 +324,10 @@
                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."
@@ -486,7 +490,10 @@
                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"
@@ -530,6 +537,10 @@
     <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"
@@ -566,7 +577,10 @@
                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"
@@ -641,6 +655,10 @@
     <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"
@@ -730,6 +748,9 @@
                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"
@@ -763,6 +784,10 @@
     <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"
@@ -807,6 +832,10 @@
                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"
@@ -887,6 +916,10 @@
                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"
@@ -1003,6 +1036,10 @@
                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"
@@ -1054,7 +1091,10 @@
                 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>

Modified: 
tomcat/trunk/java/org/apache/catalina/ha/session/mbeans-descriptors.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/ha/session/mbeans-descriptors.xml?rev=992245&r1=992244&r2=992245&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/ha/session/mbeans-descriptors.xml 
(original)
+++ tomcat/trunk/java/org/apache/catalina/ha/session/mbeans-descriptors.xml Fri 
Sep  3 09:48:46 2010
@@ -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"
@@ -287,6 +290,9 @@
       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"
@@ -511,6 +517,9 @@
       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"

Modified: tomcat/trunk/java/org/apache/catalina/ha/tcp/mbeans-descriptors.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/ha/tcp/mbeans-descriptors.xml?rev=992245&r1=992244&r2=992245&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/ha/tcp/mbeans-descriptors.xml 
(original)
+++ tomcat/trunk/java/org/apache/catalina/ha/tcp/mbeans-descriptors.xml Fri Sep 
 3 09:48:46 2010
@@ -54,6 +54,10 @@
       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.')"
@@ -148,6 +152,10 @@
       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"

Modified: tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java?rev=992245&r1=992244&r2=992245&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java 
(original)
+++ tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java Fri Sep 
 3 09:48:46 2010
@@ -1807,6 +1807,15 @@ public class WebappClassLoader
     }
 
 
+    /**
+     * {...@inheritdoc}
+     */
+    @Override
+    public String getStateName() {
+        return getState().toString();
+    }
+
+
     @Override
     public void init() {
         // NOOP

Modified: tomcat/trunk/java/org/apache/catalina/loader/mbeans-descriptors.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/loader/mbeans-descriptors.xml?rev=992245&r1=992244&r2=992245&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/loader/mbeans-descriptors.xml 
(original)
+++ tomcat/trunk/java/org/apache/catalina/loader/mbeans-descriptors.xml Fri Sep 
 3 09:48:46 2010
@@ -49,6 +49,10 @@
              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;"
@@ -99,6 +103,10 @@
              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;"
@@ -145,6 +153,10 @@
           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;"/>

Modified: tomcat/trunk/java/org/apache/catalina/realm/mbeans-descriptors.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/realm/mbeans-descriptors.xml?rev=992245&r1=992244&r2=992245&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/realm/mbeans-descriptors.xml 
(original)
+++ tomcat/trunk/java/org/apache/catalina/realm/mbeans-descriptors.xml Fri Sep  
3 09:48:46 2010
@@ -57,6 +57,10 @@
           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"/>
@@ -120,6 +124,10 @@
           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"/>
@@ -187,6 +195,10 @@
           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"/>
@@ -305,6 +317,10 @@
           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"/>
@@ -371,6 +387,10 @@
           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"/>
@@ -413,6 +433,10 @@
           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"/>
@@ -456,6 +480,10 @@
           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"/>

Modified: tomcat/trunk/java/org/apache/catalina/session/mbeans-descriptors.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/session/mbeans-descriptors.xml?rev=992245&r1=992244&r2=992245&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/session/mbeans-descriptors.xml 
(original)
+++ tomcat/trunk/java/org/apache/catalina/session/mbeans-descriptors.xml Fri 
Sep  3 09:48:46 2010
@@ -111,6 +111,10 @@
           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"/>
@@ -306,6 +310,10 @@
           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"/>

Modified: tomcat/trunk/java/org/apache/catalina/util/LifecycleBase.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/util/LifecycleBase.java?rev=992245&r1=992244&r2=992245&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/util/LifecycleBase.java (original)
+++ tomcat/trunk/java/org/apache/catalina/util/LifecycleBase.java Fri Sep  3 
09:48:46 2010
@@ -286,6 +286,15 @@ public abstract class LifecycleBase impl
 
 
     /**
+     * {...@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.

Modified: tomcat/trunk/java/org/apache/catalina/valves/mbeans-descriptors.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/valves/mbeans-descriptors.xml?rev=992245&r1=992244&r2=992245&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/valves/mbeans-descriptors.xml 
(original)
+++ tomcat/trunk/java/org/apache/catalina/valves/mbeans-descriptors.xml Fri Sep 
 3 09:48:46 2010
@@ -86,6 +86,10 @@
                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"/>
@@ -125,6 +129,10 @@
                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"
@@ -251,6 +259,10 @@
                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"
@@ -285,6 +297,10 @@
                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"
@@ -319,6 +335,10 @@
                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"
@@ -371,6 +391,10 @@
                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"



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

Reply via email to