Skip to content

Commit

Permalink
Further fix to regression in r1725599
Browse files Browse the repository at this point in the history
Trigger a call to stop() if a component puts itself into the FAILED
state during start().

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1725694 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
markt-asf committed Jan 20, 2016
1 parent 69c8909 commit 1d894a1
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions java/org/apache/catalina/util/LifecycleBase.java
Expand Up @@ -151,18 +151,24 @@ public final synchronized void start() throws LifecycleException {
try {
startInternal();
} catch (Throwable t) {
// This is an 'uncontrolled' failure so put the component into the
// FAILED state and throw an exception.
ExceptionUtils.handleThrowable(t);
setStateInternal(LifecycleState.FAILED, null, false);
throw new LifecycleException(sm.getString("lifecycleBase.startFail", toString()), t);
}

// Shouldn't be necessary but acts as a check that sub-classes are
// doing what they are supposed to.
if (!state.equals(LifecycleState.STARTING)) {
if (state.equals(LifecycleState.FAILED)) {
// This is a 'controlled' failure. The component put itself into the
// FAILED state so call stop() to complete the clean-up.
stop();
} else if (!state.equals(LifecycleState.STARTING)) {
// Shouldn't be necessary but acts as a check that sub-classes are
// doing what they are supposed to.
invalidTransition(Lifecycle.AFTER_START_EVENT);
} else {
setStateInternal(LifecycleState.STARTED, null, false);
}

setStateInternal(LifecycleState.STARTED, null, false);
}


Expand Down

0 comments on commit 1d894a1

Please sign in to comment.