Package org.drools

Examples of org.drools.StatefulSession.dispose()


        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        marshaller.marshall( baos, ksession );
        byte[] b1 = baos.toByteArray();
        session.halt();
        session.dispose();
        Thread.sleep(400);
       
        ByteArrayInputStream bais = new ByteArrayInputStream( b1 );       
        final StatefulSession session2 = ( StatefulSession ) (( StatefulKnowledgeSessionImpl) marshaller.unmarshall( bais ) ).session;
       
View Full Code Here


       
        assertEquals( list.size(), 1 );
        assertEquals( "stilton", list.get( 0 ));
       
        byte[] serializedSession = serializeOut( session );
        session.dispose();
       
        byte[] serializedRulebase = serializeOut( ruleBase );
       
        // now recreate the rulebase, deserialize the session and test it
        ruleBase = (RuleBase) serializeIn( serializedRulebase );
View Full Code Here

       
        assertEquals( list.size(), 3 );
        assertEquals( bob.getObject(), list.get( 1 ));
        assertEquals( "stilton", list.get( 2 ));
       
        session.dispose();
       
    }

    public class SubvertedClassLoader extends URLClassLoader {
View Full Code Here

                      1 );
        assertEquals( "stilton",
                      list.get( 0 ) );

        byte[] serializedSession = serializeOut( session );
        session.dispose();

        byte[] serializedRulebase = serializeOut( ruleBase );

        // now recreate the rulebase, deserialize the session and test it
        ruleBase = (RuleBase) serializeIn( serializedRulebase );
View Full Code Here

        assertEquals( bob.getObject(),
                      list.get( 1 ) );
        assertEquals( "stilton",
                      list.get( 2 ) );

        session.dispose();

    }

    public void testSerializationOfIndexedWM() throws Exception {
        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_Serializable2.drl" ) );
View Full Code Here

                      results.get( 0 ) );

        // serialize session and rulebase out
        byte[] serializedSession = serializeOut( session );
        byte[] serializedRulebase = serializeOut( ruleBase );
        session.dispose();

        // now deserialize the rulebase, deserialize the session and test it
        ruleBase = (RuleBase) serializeIn( serializedRulebase );
        session = ruleBase.newStatefulSession( new ByteArrayInputStream( serializedSession ) );
View Full Code Here

        serializedSession = serializeOut( session );
        serializedRulebase = serializeOut( ruleBase );

        // dispose session
        session.dispose();

    }

    /*
     *  Here I am inserting data points(e.g. Cheese) with  'stilton' / 'brie' as type value.
View Full Code Here

        session.fireAllRules();

        byte[] serializedSession = serializeOut( session );
        byte[] serializedRulebase = serializeOut( ruleBase );

        session.dispose();

        assertEquals( 1,
                      results.size() );
        assertEquals( stilton1.getObject(),
                      results.get( 0 ) );
View Full Code Here

        serializedRulebase = null;

        serializedSession = serializeOut( session );
        serializedRulebase = serializeOut( ruleBase );

        session.dispose();
    }

    /*
     *  Works Fine if both the scenarios mentioned above are skipped.
     */
 
View Full Code Here

        session.fireAllRules();

        byte[] serializedSession = serializeOut( session );
        byte[] serializedRulebase = serializeOut( ruleBase );

        session.dispose();

        assertEquals( 1,
                      results.size() );
        assertEquals( stilton1.getObject(),
                      results.get( 0 ) );
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.