Work after Sonarcloud

This commit is contained in:
Nicolas Héron 2020-06-01 16:34:55 +02:00
commit 0a97629aa5
25 changed files with 256 additions and 503 deletions

View file

@ -9,13 +9,24 @@ import java.net.InetAddress;
import java.net.UnknownHostException;
public class MainClass {
public static void main(String [] args) throws UnknownHostException {
public static void main(String[] args) throws UnknownHostException {
Settings settings = Settings.builder()
.put("cluster.name", "myClusterName").build();
TransportClient client = new PreBuiltTransportClient(settings)
.addTransportAddress(new TransportAddress(InetAddress.getByName("localhost"), 9300));
TransportClient client = null;
PreBuiltTransportClient preBuiltTransportClient=null;
try {
preBuiltTransportClient = new PreBuiltTransportClient(settings);
client = preBuiltTransportClient
.addTransportAddress(new TransportAddress(InetAddress.getByName("localhost"), 9300));
} finally {
if (client != null) {
client.close();
}
if (preBuiltTransportClient!=null){
preBuiltTransportClient.close();
}
}
// on shutdown
client.close(); }
}
}

View file

@ -210,16 +210,18 @@ public class KieServiceCommon {
Set<Class<?>> classes = kieContainerInstance.getExtraClasses();
String className = container.getClassName();
Class foundClass = this.getClassFromName(classes, className);
ClassLoader classLoader = foundClass.getClassLoader();
Class<?> theClass = classLoader.loadClass(className);
camelContext.setApplicationContextClassLoader(classLoader);
Thread.currentThread().setContextClassLoader(classLoader);
String projectName = container.getContainerId();
String processId = container.getProcessID();
this.deleteCamelBusinessRoute(projectName);
DroolsRouter droolsRouter = new DroolsRouter(camelContext, theClass, projectName, kieContainerInstance, processId);
camelContext.addRoutes(droolsRouter);
routes.put(containerId, droolsRouter);
if (foundClass!=null) {
ClassLoader classLoader = foundClass.getClassLoader();
Class<?> theClass = classLoader.loadClass(className);
camelContext.setApplicationContextClassLoader(classLoader);
Thread.currentThread().setContextClassLoader(classLoader);
String projectName = container.getContainerId();
String processId = container.getProcessID();
this.deleteCamelBusinessRoute(projectName);
DroolsRouter droolsRouter = new DroolsRouter(camelContext, theClass, projectName, kieContainerInstance, processId);
camelContext.addRoutes(droolsRouter);
routes.put(containerId, droolsRouter);
}
} finally {
if (localClassLoader != null) {
Thread.currentThread().setContextClassLoader(localClassLoader);