You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2014/02/05 11:09:33 UTC

[4/4] git commit: github pull request #90 - Provide access to the shutdown task Future in order to have more control over it. Thanks to Antoine for the patch. Revised patch slightly.

github pull request #90 - Provide access to the shutdown task Future in order to have more control over it. Thanks to Antoine for the patch. Revised patch slightly.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/c5804801
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/c5804801
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/c5804801

Branch: refs/heads/camel-2.12.x
Commit: c580480198ff806607fe5507468b04018a2e6a5b
Parents: adec300
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Feb 5 10:42:39 2014 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Feb 5 11:10:22 2014 +0100

----------------------------------------------------------------------
 .../org/apache/camel/impl/DefaultShutdownStrategy.java   | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/c5804801/camel-core/src/main/java/org/apache/camel/impl/DefaultShutdownStrategy.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultShutdownStrategy.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultShutdownStrategy.java
index 72145a8..2d05aea 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultShutdownStrategy.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultShutdownStrategy.java
@@ -177,7 +177,13 @@ public class DefaultShutdownStrategy extends ServiceSupport implements ShutdownS
         currentShutdownTaskFuture = getExecutorService().submit(new ShutdownTask(context, routesOrdered, timeout, timeUnit, suspendOnly, abortAfterTimeout, timeoutOccurred));
         try {
             currentShutdownTaskFuture.get(timeout, timeUnit);
-        } catch (TimeoutException e) {
+        } catch (ExecutionException e) {
+            // unwrap execution exception
+            throw ObjectHelper.wrapRuntimeCamelException(e.getCause());
+        } catch (Exception e) {
+            // either timeout or interrupted exception was thrown so this is okay
+            // as interrupted would mean cancel was called on the currentShutdownTaskFuture to signal a forced timeout
+
             // we hit a timeout, so set the flag
             timeoutOccurred.set(true);
 
@@ -207,9 +213,6 @@ public class DefaultShutdownStrategy extends ServiceSupport implements ShutdownS
                     LOG.warn("Timeout occurred. Will ignore shutting down the remainder routes.");
                 }
             }
-        } catch (ExecutionException e) {
-            // unwrap execution exception
-            throw ObjectHelper.wrapRuntimeCamelException(e.getCause());
         } finally {
             currentShutdownTaskFuture = null;
         }