Just log multiple calls to destroy rather than throwing an Exception.
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Sun, 2 May 2010 19:05:07 +0000 (19:05 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Sun, 2 May 2010 19:05:07 +0000 (19:05 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@940304 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/util/LifecycleBase.java
java/org/apache/catalina/util/LocalStrings.properties

index daf4554..34c7b91 100644 (file)
@@ -258,6 +258,20 @@ public abstract class LifecycleBase implements Lifecycle {
 
 
     public synchronized final void destroy() throws LifecycleException {
+        if (LifecycleState.DESTROYED.equals(state)) {
+
+            if (log.isDebugEnabled()) {
+                Exception e = new LifecycleException();
+                log.debug(sm.getString("lifecycleBase.alreadyDestroyed",
+                        toString()), e);
+            } else if (log.isInfoEnabled()) {
+                log.info(sm.getString("lifecycleBase.alreadyDestroyed",
+                        toString()));
+            }
+            
+            return;
+        }
+        
         if (!state.equals(LifecycleState.STOPPED) &&
                 !state.equals(LifecycleState.FAILED)) {
             invalidTransition(Lifecycle.DESTROY_EVENT);
index eabaac3..606df75 100644 (file)
@@ -25,6 +25,7 @@ extensionValidator.failload=Failure loading extension [{0}]
 lifecycleBase.initMBeanFail=Failed to register component [{0}] with MBean name [{1}]
 lifecycleBase.alreadyStarted=The start() method was called on component [{0}] after start() had already been called. The second call will be ignored.
 lifecycleBase.alreadyStopped=The stop() method was called on component [{0}] after stop() had already been called. The second call will be ignored.
+lifecycleBase.alreadyDestroyed=The destroy() method was called on component [{0}] after destroy() had already been called. The second call will be ignored.
 lifecycleBase.invalidTransition=An invalid Lifecycle transition was attempted ([{0}]) for component [{1}] in state [{2}]
 requestUtil.convertHexDigit.notHex=[{0}] is not a hexadecimal digit
 requestUtil.parseParameters.uee=Unable to parse the parameters since the encoding [{0}] is not supported.