[rules-users] Re : Drools 4.0.x branch has still some issues with serialization
siddhartha banik
siddhartha.banik at gmail.com
Thu Mar 20 14:11:09 EDT 2008
Hi Group Members,
In Drools 4.0.5 release most of the bugs with *"Working Memory
serialization"* are fixed. But still the feature has few bugs.
The bug scenario :
1. Create a rule Base & Working Memory (Stateful Session).
2. Assert some objects in Working Memory & call fireAll()
3. Serialize both Rule Base & Working Memory.
4. De Serialize Rule Base & Working Memory.
5. Remove Pkg/rule from Rule Base.
6. Serialize both Rule Base & Working Memory.
7. De Serialize Rule Base & Working Memory. --------->* In this step Working
Memory De Serialization fails with java.lang.ClassNotFoundException.
*8. Assert some more objects in Working Memory & call fireAll()
I have tested the scenario using *"MarshallingTest.java"* from Drools
Codebase. In the *
MarshallingTest.testSerializeAddRemove_NoClassDefFoundError()* test case,
I have appended bellow mentioned code snippet at end:
ruleBase = (RuleBase) serializeIn( serializedRulebase );
session = ruleBase.newStatefulSession( new ByteArrayInputStream(
serializedSession ) ); *// throws java.lang.ClassNotFoundExceptionException
* 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20080320/b56fbe92/attachment.html
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: MarshallingTest.java
Url: http://lists.jboss.org/pipermail/rules-users/attachments/20080320/b56fbe92/attachment.pl
More information about the rules-users
mailing list