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-11889] Kie assumes that the TCCL can load its services
Date Fri, 13 Oct 2017 08:20:37 GMT
Repository: camel
Updated Branches:
  refs/heads/camel-2.20.x c412e5d1e -> 370aa61f6


[CAMEL-11889] Kie assumes that the TCCL can load its services


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

Branch: refs/heads/camel-2.20.x
Commit: 370aa61f6e821a0f38a96594e5f98d2cf40f46ca
Parents: c412e5d
Author: Thomas Diesler <tdiesler@redhat.com>
Authored: Mon Oct 9 17:22:56 2017 +0200
Committer: Andrea Cosentino <ancosen@gmail.com>
Committed: Fri Oct 13 10:20:24 2017 +0200

----------------------------------------------------------------------
 .../component/optaplanner/OptaPlannerComponent.java    | 13 +++++++++++++
 1 file changed, 13 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/370aa61f/components/camel-optaplanner/src/main/java/org/apache/camel/component/optaplanner/OptaPlannerComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-optaplanner/src/main/java/org/apache/camel/component/optaplanner/OptaPlannerComponent.java
b/components/camel-optaplanner/src/main/java/org/apache/camel/component/optaplanner/OptaPlannerComponent.java
index 2d0a720..4952573 100644
--- a/components/camel-optaplanner/src/main/java/org/apache/camel/component/optaplanner/OptaPlannerComponent.java
+++ b/components/camel-optaplanner/src/main/java/org/apache/camel/component/optaplanner/OptaPlannerComponent.java
@@ -20,6 +20,8 @@ import java.util.Map;
 
 import org.apache.camel.Endpoint;
 import org.apache.camel.impl.DefaultComponent;
+import org.apache.camel.util.ObjectHelper;
+import org.kie.api.KieServices;
 
 /**
  * OptaPlanner component for Camel
@@ -30,6 +32,17 @@ public class OptaPlannerComponent extends DefaultComponent {
         OptaPlannerConfiguration configuration = new OptaPlannerConfiguration();
         configuration.setConfigFile(remaining);
         setProperties(configuration, parameters);
+        
+        // [CAMEL-11889] Kie assumes that the TCCL can load its services
+        ClassLoader tccl = Thread.currentThread().getContextClassLoader();
+        try {
+            Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
+            KieServices kieServices = KieServices.Factory.get();
+            ObjectHelper.notNull(kieServices, "KieServices");
+        } finally {
+            Thread.currentThread().setContextClassLoader(tccl);
+        }
+        
         return new OptaPlannerEndpoint(uri, this, configuration);
     }
 


Mime
View raw message