camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [4/4] git commit: CAMEL-6421: Use a private lock for getErrorHandlerExecutorService() to avoid any hang during shutdown route/camel when multiple threads is in use.
Date Tue, 04 Jun 2013 07:49:06 GMT
CAMEL-6421: Use a private lock for getErrorHandlerExecutorService() to avoid any hang during
shutdown route/camel when multiple threads is in use.


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

Branch: refs/heads/camel-2.10.x
Commit: 8d2e138b9456c421b7dc0d21437e6125fcb9cf30
Parents: eb74917
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Tue Jun 4 09:29:28 2013 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Tue Jun 4 09:48:43 2013 +0200

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


http://git-wip-us.apache.org/repos/asf/camel/blob/8d2e138b/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
index 1b1d908..ed4f72a 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
@@ -178,6 +178,7 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon
     private Boolean useBreadcrumb = Boolean.TRUE;
     private Long delay;
     private ErrorHandlerFactory errorHandlerBuilder;
+    private final Object errorHandlerExecutorServiceLock = new Object();
     private ScheduledExecutorService errorHandlerExecutorService;
     private Map<String, DataFormatDefinition> dataFormats = new HashMap<String,
DataFormatDefinition>();
     private DataFormatResolver dataFormatResolver = new DefaultDataFormatResolver();
@@ -1311,10 +1312,12 @@ public class DefaultCamelContext extends ServiceSupport implements
ModelCamelCon
         this.errorHandlerBuilder = errorHandlerBuilder;
     }
 
-    public synchronized ScheduledExecutorService getErrorHandlerExecutorService() {
-        if (errorHandlerExecutorService == null) {
-            // setup default thread pool for error handler
-            errorHandlerExecutorService = getExecutorServiceManager().newDefaultScheduledThreadPool("ErrorHandlerRedeliveryThreadPool",
"ErrorHandlerRedeliveryTask");
+    public ScheduledExecutorService getErrorHandlerExecutorService() {
+        synchronized (errorHandlerExecutorServiceLock) {
+            if (errorHandlerExecutorService == null) {
+                // setup default thread pool for error handler
+                errorHandlerExecutorService = getExecutorServiceManager().newDefaultScheduledThreadPool("ErrorHandlerRedeliveryThreadPool",
"ErrorHandlerRedeliveryTask");
+            }
         }
         return errorHandlerExecutorService;
     }


Mime
View raw message