[jboss-jira] [JBoss JIRA] (DROOLS-1142) Attempted reload of persisted KieSession operating in STREAM mode throws Exceptions

Mario Fusco (JIRA) issues at jboss.org
Thu Apr 28 04:51:00 EDT 2016


     [ https://issues.jboss.org/browse/DROOLS-1142?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mario Fusco resolved DROOLS-1142.
---------------------------------
    Fix Version/s: 7.0.0.Beta1
       Resolution: Done


I tried to reproduce this issue on master with the test case I'm pasting below but it works for me. I'm pretty sure this has been fixed by https://issues.jboss.org/browse/DROOLS-1119

{code}
    @Test
    public void testCepSerialization() {
        String str =
                "import " + MyEvent.class.getCanonicalName() + " \n" +
                "import " + java.util.Date.class.getCanonicalName() + " \n" +
                "declare MyEvent\n" +
                "    @role( event )\n" +
                "    @expires( 3s ) \n" +
                "end\n" +
                "\n" +
                "rule 'MyEvent'\n" +
                "when\n" +
                "    $m: MyEvent()\n" +
                "then\n" +
                "    System.out.println(new Date() + \" demoReload: Got MyEvent, id=\" + $m.getId());\n" +
                "end\n";

        KieServices ks = KieServices.Factory.get();

        KieFileSystem kfs = ks.newKieFileSystem().write( "src/main/resources/r1.drl", str );
        ks.newKieBuilder( kfs ).buildAll();

        KieBaseConfiguration kbConf = ks.newKieBaseConfiguration();
        kbConf.setOption( EventProcessingOption.STREAM );

        KieBase kieBase = ks.newKieContainer( ks.getRepository().getDefaultReleaseId() ).newKieBase(kbConf);
        KieSession kieSession = ks.getStoreServices().newKieSession( kieBase, null, env );

        long kieSessionId = kieSession.getIdentifier();
        kieSession.insert(new MyEvent("EVENT1"));
        kieSession.fireAllRules();
        kieSession.dispose();

        // Timer in MyEvent.drl set for 3 second expiration, so it will already have expired
        // when session reload is attempted.
        //
        try {
            Thread.sleep(5000);
        } catch (InterruptedException e) {
            throw new RuntimeException( e );
        }

        kieSession = ks.getStoreServices().loadKieSession( kieSessionId, kieBase, null, env );
        kieSession.fireAllRules();
        kieSession.dispose();

    }

    public static class MyEvent implements Serializable {
        private String id;
        public MyEvent(String id) {
            this.id = id;
        }
        public String getId() {
            return id;
        }
    }
{code}

> Attempted reload of persisted KieSession operating in STREAM mode throws Exceptions
> -----------------------------------------------------------------------------------
>
>                 Key: DROOLS-1142
>                 URL: https://issues.jboss.org/browse/DROOLS-1142
>             Project: Drools
>          Issue Type: Bug
>          Components: core engine
>    Affects Versions: 6.3.0.Final, 6.4.0.Final
>         Environment: Produced in Windows 7 environment
>            Reporter: Kevin Solveson
>            Assignee: Mario Fusco
>              Labels: jboss
>             Fix For: 7.0.0.Beta1
>
>
> Please see [http://stackoverflow.com/questions/36755445/why-am-i-getting-exception-on-kiesession-reload] for a discussion of this issue.   In short, I'm running a simple test where the KieSession is operating in STREAM mode. I define "MyEvent" as an event and specify that it should expire in 3s. After inserting the event, I dispose of the KieSession, sleep for 5s (to allow the timer to expire), and then attempt to reload the session. However, when I attempt the session reload, I get Exceptions as shown.



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)


More information about the jboss-jira mailing list