camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [3/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:05 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/b739a43c
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/b739a43c
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/b739a43c

Branch: refs/heads/camel-2.11.x
Commit: b739a43cf172845b280871d52964c9c79414789b
Parents: 3b3e472
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:24 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/b739a43c/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 8789aa8..b059e86 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
@@ -180,6 +180,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();
@@ -1336,10 +1337,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