camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [3/3] camel git commit: A bit better error message in throttler if it was interrupted during force shutdown of Camel
Date Sat, 13 Feb 2016 08:32:52 GMT
A bit better error message in throttler if it was interrupted during force shutdown of Camel


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

Branch: refs/heads/master
Commit: d022baa6726045fcdd467e7939d3916d7c0cbe03
Parents: b444042
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Sat Feb 13 09:32:04 2016 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Sat Feb 13 09:32:04 2016 +0100

----------------------------------------------------------------------
 .../main/java/org/apache/camel/processor/Throttler.java | 12 ++++++++++++
 1 file changed, 12 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/d022baa6/camel-core/src/main/java/org/apache/camel/processor/Throttler.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/processor/Throttler.java b/camel-core/src/main/java/org/apache/camel/processor/Throttler.java
index dda02ec..5fe3b46 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/Throttler.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/Throttler.java
@@ -173,6 +173,18 @@ public class Throttler extends DelegateAsyncProcessor implements Traceable,
IdAw
             callback.done(doneSync);
             return doneSync;
 
+        } catch (final InterruptedException e) {
+            // determine if we can still run, or the camel context is forcing a shutdown
+            boolean forceShutdown = exchange.getContext().getShutdownStrategy().forceShutdown(this);
+            if (forceShutdown) {
+                String msg = "Run not allowed as ShutdownStrategy is forcing shutting down,
will reject executing exchange: " + exchange;
+                log.debug(msg);
+                exchange.setException(new RejectedExecutionException(msg, e));
+            } else {
+                exchange.setException(e);
+            }
+            callback.done(doneSync);
+            return doneSync;
         } catch (final Throwable t) {
             exchange.setException(t);
             callback.done(doneSync);


Mime
View raw message