Author: markt
Date: Tue Jul 26 08:25:46 2011
New Revision: 1151016
URL: http://svn.apache.org/viewvc?rev=1151016&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=51555
Permit an additional lifecycle transition. Allow destroy() to be called on
components that are initialized. This can occur in some start failure scenarios.
Modified:
tomcat/trunk/java/org/apache/catalina/Lifecycle.java
tomcat/trunk/java/org/apache/catalina/util/LifecycleBase.java
tomcat/trunk/webapps/docs/changelog.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=1151016&r1=1151015&r2=1151016&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/Lifecycle.java (original)
+++ tomcat/trunk/java/org/apache/catalina/Lifecycle.java Tue Jul 26 08:25:46
2011
@@ -14,8 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-
package org.apache.catalina;
@@ -28,35 +26,38 @@ package org.apache.catalina;
* The valid state transitions for components that support {@link Lifecycle}
* are:
* <pre>
- * init()
- * NEW ->-- INITIALIZING
- * ||| |
--------------------<-----------------------
- * ||| |auto |
|
- * ||| \|/ start() \|/ auto auto stop()
|
- * ||| INITIALIZED -->-- STARTING_PREP -->- STARTING -->- STARTED -->---
|
- * ||| ^ | |
|
- * ||| start() | | |
|
- * ||----------->-------------------- | |
|
- * || | |
|
- * |--- auto auto | |
|
- * | | ---------<----- MUST_STOP ---------------------<-- |
|
- * | | | |
|
- * | | ---------------------------<--------------------------------
^
- * | | |
|
- * | | \|/ auto auto start()
|
- * | | STOPPING_PREP ------>----- STOPPING ------>----- STOPPED
---->------
- * | | ^ | | ^
- * | | stop() | | | |
- * | | -------------------------- | | |
- * | | | auto | | |
- * | | | MUST_DESTROY------<------- | |
- * | | | | | |
- * | | | |auto | |
- * | | | destroy() \|/ destroy() | |
- * | | FAILED ---->------ DESTROYING ---<----------------- |
- * | | ^ | |
- * | | destroy() | |auto |
- * | ----------------------------- \|/ |
+ * start()
+ * -----------------------------
+ * | |
+ * | init() |
+ * NEW ->-- INITIALIZING |
+ * | | | |
------------------<-----------------------
+ * | | |auto | |
|
+ * | | \|/ start() \|/ \|/ auto auto stop()
|
+ * | | INITIALIZED -->-- STARTING_PREP -->- STARTING -->- STARTED -->---
|
+ * | | | | |
|
+ * | | | | |
|
+ * | | | | |
|
+ * | |destroy()| | |
|
+ * | -->-----<-- auto auto | |
|
+ * | | ---------<----- MUST_STOP ---------------------<-- |
|
+ * | | | |
|
+ * | \|/ ---------------------------<--------------------------------
^
+ * | | |
|
+ * | | \|/ auto auto start()
|
+ * | | STOPPING_PREP ------>----- STOPPING ------>----- STOPPED
---->------
+ * | | ^ | | ^
+ * | | stop() | | | |
+ * | | -------------------------- | | |
+ * | | | auto | | |
+ * | | | MUST_DESTROY------<------- | |
+ * | | | | | |
+ * | | | |auto | |
+ * | | | destroy() \|/ destroy() | |
+ * | | FAILED ---->------ DESTROYING ---<----------------- |
+ * | | ^ | |
+ * | | destroy() | |auto |
+ * | -------->----------------- \|/ |
* | DESTROYED |
* | |
* | stop() |
@@ -93,7 +94,8 @@ package org.apache.catalina;
* methods that trigger the changed. No {@link LifecycleEvent}s are fired if
the
* attempted transition is not valid.
*
- * TODO: Not all components may transition from STOPPED to STARTING_PREP
+ * TODO: Not all components may transition from STOPPED to STARTING_PREP. These
+ * components should use MUST_DESTROY to signal this.
*
* @author Craig R. McClanahan
* @version $Id$
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=1151016&r1=1151015&r2=1151016&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/util/LifecycleBase.java (original)
+++ tomcat/trunk/java/org/apache/catalina/util/LifecycleBase.java Tue Jul 26
08:25:46 2011
@@ -274,7 +274,8 @@ public abstract class LifecycleBase impl
if (!state.equals(LifecycleState.STOPPED) &&
!state.equals(LifecycleState.FAILED) &&
- !state.equals(LifecycleState.NEW)) {
+ !state.equals(LifecycleState.NEW) &&
+ !state.equals(LifecycleState.INITIALIZED)) {
invalidTransition(Lifecycle.BEFORE_DESTROY_EVENT);
}
Modified: tomcat/trunk/webapps/docs/changelog.xml
URL:
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1151016&r1=1151015&r2=1151016&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Tue Jul 26 08:25:46 2011
@@ -86,6 +86,10 @@
Authenticators, now return a 500 response rather than a 200 response.
(markt)
</fix>
+ <fix>
+ <bug>51555</bug>: Allow destroy() to be called on Lifecycle components
+ that are in the initialized state. (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="Coyote">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]