Created
August 3, 2016 08:54
-
-
Save tarilabs/7af2ac16f560517d59bc45c0032a7a9f to your computer and use it in GitHub Desktop.
concurrent creation of kiecontainer check
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void testMATTEO() throws InterruptedException { | |
ReleaseId releaseId = ks.newReleaseId("org.kie", "test-delete", "1.0.0"); | |
createAndDeployJar( ks, releaseId, createDRL("ruleA") ); | |
ExecutorService es = Executors.newFixedThreadPool(10); | |
List<Callable<Boolean>> list = new ArrayList<Callable<Boolean>>(); | |
for (int i = 0; i < 6; i++) { | |
list.add(new Callable<Boolean>() { | |
@Override | |
public Boolean call() { ks.newKieContainer("id1", releaseId); return true;} | |
}); | |
} | |
List<Future<Boolean>> invokeAll = es.invokeAll(list); | |
for (Future<Boolean> f : invokeAll) { | |
try { | |
System.out.println( f.get() ); | |
} catch (ExecutionException e) { | |
System.err.println(e.getMessage()); | |
} | |
} | |
try { | |
ks.newKieContainer("id1", releaseId); | |
} catch (Exception e) { | |
System.err.println(e.getMessage()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment