camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acosent...@apache.org
Subject camel git commit: CAMEL-10411 - camel-blueprint. prevent automated restart in case of errors
Date Tue, 25 Oct 2016 06:47:57 GMT
Repository: camel
Updated Branches:
  refs/heads/master a2b3823fe -> bf8d0de57


CAMEL-10411 - camel-blueprint. prevent automated restart in case of errors


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

Branch: refs/heads/master
Commit: bf8d0de57b303e3e8b137e21ac96162a9b1fb921
Parents: a2b3823
Author: Paolo Antinori <pantinor@redhat.com>
Authored: Mon Oct 24 17:31:40 2016 +0200
Committer: Paolo Antinori <pantinor@redhat.com>
Committed: Mon Oct 24 17:31:40 2016 +0200

----------------------------------------------------------------------
 .../apache/camel/blueprint/BlueprintCamelContext.java  | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/bf8d0de5/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintCamelContext.java
----------------------------------------------------------------------
diff --git a/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintCamelContext.java
b/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintCamelContext.java
index 02c9082..865328a 100644
--- a/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintCamelContext.java
+++ b/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/BlueprintCamelContext.java
@@ -19,7 +19,9 @@ package org.apache.camel.blueprint;
 import java.io.IOException;
 import java.util.Map;
 import java.util.Properties;
+import java.util.concurrent.atomic.AtomicBoolean;
 
+import org.apache.camel.FailedToCreateRouteException;
 import org.apache.camel.TypeConverter;
 import org.apache.camel.blueprint.handler.CamelNamespaceHandler;
 import org.apache.camel.core.osgi.OsgiCamelContextHelper;
@@ -54,6 +56,7 @@ public class BlueprintCamelContext extends DefaultCamelContext implements
Servic
     private BundleContext bundleContext;
     private BlueprintContainer blueprintContainer;
     private ServiceRegistration<?> registration;
+    protected final AtomicBoolean routeDefinitionValid = new AtomicBoolean(true);
 
     public BlueprintCamelContext() {
     }
@@ -183,7 +186,10 @@ public class BlueprintCamelContext extends DefaultCamelContext implements
Servic
             // let's set a more suitable TCCL while starting the context
             Thread.currentThread().setContextClassLoader(getApplicationContextClassLoader());
             super.start();
-        } finally {
+        } catch (FailedToCreateRouteException e){
+            routeDefinitionValid.set(false);
+        }
+        finally {
             Thread.currentThread().setContextClassLoader(original);
         }
     }
@@ -191,6 +197,11 @@ public class BlueprintCamelContext extends DefaultCamelContext implements
Servic
     private void maybeStart() throws Exception {
         LOG.trace("maybeStart: {}", this);
 
+        if(!routeDefinitionValid.get()){
+            LOG.trace("maybeStart: {} is skipping since CamelRoute definition is not correct.",
this);
+            return;
+        }
+
         // allow to register the BluerintCamelContext eager in the OSGi Service Registry,
which ex is needed
         // for unit testing with camel-test-blueprint
         boolean eager = "true".equalsIgnoreCase(System.getProperty("registerBlueprintCamelContextEager"));


Mime
View raw message