[jboss-jira] [JBoss JIRA] (DROOLS-350) Incremental compilation is not correctly synchronized
Mario Fusco (JIRA)
jira-events at lists.jboss.org
Fri Nov 22 08:53:07 EST 2013
[ https://issues.jboss.org/browse/DROOLS-350?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mario Fusco resolved DROOLS-350.
--------------------------------
Fix Version/s: 6.0.1.Final
Resolution: Done
> Incremental compilation is not correctly synchronized
> -----------------------------------------------------
>
> Key: DROOLS-350
> URL: https://issues.jboss.org/browse/DROOLS-350
> Project: Drools
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Reporter: Mario Fusco
> Assignee: Mario Fusco
> Fix For: 6.0.1.Final
>
>
> Incremental compilation is not correctly synchronized and then a kiesession can fire when the underlying rule base is in an inconsistent state. The test case below shows the problem
> {code}
> @Test(timeout = 10000)
> public void testIncrementalCompilationSynchronization() throws Exception {
> final KieServices kieServices = KieServices.Factory.get();
> ReleaseId releaseId = kieServices.newReleaseId("org.kie.test", "sync-scanner-test", "1.0.0");
> createAndDeployJar( kieServices, releaseId, createDRL("rule0") );
> final KieContainer kieContainer = kieServices.newKieContainer(releaseId);
> KieSession kieSession = kieContainer.newKieSession();
> List<String> list = new ArrayList<String>();
> kieSession.setGlobal("list", list);
> kieSession.fireAllRules();
> kieSession.dispose();
> assertEquals(1, list.size());
> Thread t = new Thread(new Runnable() {
> @Override
> public void run() {
> for (int i = 1; i < 10; i++) {
> ReleaseId releaseId = kieServices.newReleaseId("org.kie.test", "sync-scanner-test", "1.0." + i);
> createAndDeployJar( kieServices, releaseId, createDRL("rule" + i) );
> kieContainer.updateToVersion(releaseId);
> }
> }
> });
> t.setDaemon(true);
> t.start();
> while (true) {
> kieSession = kieContainer.newKieSession();
> list = new ArrayList<String>();
> kieSession.setGlobal("list", list);
> kieSession.fireAllRules();
> kieSession.dispose();
> assertEquals(1, list.size());
> if (list.get(0).equals("rule9")) {
> break;
> }
> }
> }
> private String createDRL(String ruleName) {
> return "package org.kie.test\n" +
> "global java.util.List list\n" +
> "rule " + ruleName + "\n" +
> "when\n" +
> "then\n" +
> "list.add( drools.getRule().getName() );\n" +
> "end\n";
> }
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list