ruleBase = (RuleBase) serializeIn( serializedRulebase );
session = ruleBase.newStatefulSession( new ByteArrayInputStream( serializedSession ) ); // throws java.lang.ClassNotFoundException Exception
results = (List) session.getGlobal( "results" );
InternalFactHandle stilton5 = (InternalFactHandle) session.insert( new Cheese( "stilton", 30 ) );
InternalFactHandle brie5 = (InternalFactHandle) session.insert( new Cheese( "brie", 30 ) );
InternalFactHandle bob7 = (InternalFactHandle) session.insert( new Person( "bob", 30 ) );
InternalFactHandle bob8 = (InternalFactHandle) session.insert( new Person( "bob", 40 ) );
session.fireAllRules();
assertEquals( 8,
results.size() );
assertEquals( bob7.getObject(),
results.get( 6 ) );
assertEquals( bob8.getObject(),
results.get( 7 ) );
serializedSession = null;
serializedRulebase = null;
serializedSession = serializeOut( session );
serializedRulebase = serializeOut( ruleBase );
session.dispose();
One more bug is: Can not serialize Working Memory if Rule contains Accumulate or Collect Conditional element. Because, both of them have nested static class "AccumulateMemory" & "CollectMemory" respectively, which are not serializable.
We want to use Drools in our project with its "Working Memory serialization" feature to maintain state of Rule Engine between executions. So Fix of All bugs related to "Working Memory serialization" feature is very important for us.
Thanks
Siddhartha