[rules-users] Serialization in Drools 5.0 M2

Siddhartha Banik siddhartha.banik at gmail.com
Tue Nov 4 20:12:28 EST 2008



 Ok, The issue is fixed in the trunk. I had only Drools 5.0 M2 release
source. That code base has the issue as it is: 
 public boolean accept(Object object) {
        return this.accept( object );
    }


Hi Mark,
           I have couple of questions regarding marshalling in Drools 5.0:

                   1. In case of "SerializablePlaceholderResolverStrategy" ,
what should be "PlaceholderResolverStrategyAcceptor" impl class to be set?

                   1. In the blog :
http://blog.athico.com/2008/05/efficient-binary-protocol-marshalling.html,
you have mentioned that "Implementations have not been added for accumulate,
collect, from and rightinputadapter." If marshalling implementation is now
complete in trunk ? 

Actually, I was evaluating Drools 5.0 M2 release for our next Drools
upgrade. We are heavy user of serialization feature in Drools 4.0.7.

Best Regards!
Siddhartha 


Mark Proctor wrote:
> 
> Siddhartha Banik wrote:
>> Hi Michal,
>>
>> Thanks for your reply.
>> I have got a better idea about marshalling now. After I have made the
>> changes you suggested, the things are working now.
>>
>> There is a bug in "SerializablePlaceholderResolverStrategy.java" file
>> Line#38. Recursive call is made inside the method "public boolean
>> accept(Object object)" . So marshalling is failing with
>> stackOverflowError.
>>   
> I think that is fixed... This is what I have in trunk:
>     public boolean accept(Object object) {
>         return acceptor.accept( object );
>     }
> 
> Doesn't look recursive to me.
>> The blog
>> "http://blog.athico.com/2008/05/efficient-binary-protocol-marshalling.html"
>> says : 
>>
>> It's still very alphaware. The following types don't yet marshall, not
>> sure
>> how to handle date/time stuff at the moment. Implementations have not
>> been
>> added for accumulate, collect, from and rightinputadapter.
>>
>> If these issues are fixed in Drools 5.0 M2 release? 
>>
>> Best Regards!
>> Siddhartha
>>
>>
>> Siddhartha Banik wrote:
>>   
>>> Hi Drools Team,
>>>
>>> I am trying out new Serialization technique introduced in Drools 5.0
>>> using
>>> "
>>> org.drools.marshalling.DefaultMarshaller".
>>>
>>> The use case I am trying, is:
>>>                                       Create a Stateful session.
>>>                                       Then Serialize that.
>>>                                       Try to load the the serialized
>>> session
>>> back.
>>>
>>> Loading of serialized session is working good if, I try that in same
>>> java
>>> program & same object of DefaultMarshaller is used during serialization
>>> &
>>> de
>>> serialization of the Stateful session.
>>>
>>> But, when I tried a different instance of DefaultMarshaller to read back
>>> the
>>> saved session, that is not working anymore. I am getting a exception :
>>>
>>> java.lang.NullPointerException
>>>  at
>>> org.drools.common.DefaultFactHandle.<init>(DefaultFactHandle.java:78)
>>>  at
>>> org.drools.marshalling.InputMarshaller.readFactHandle(InputMarshaller.java:331)
>>>  at
>>> org.drools.marshalling.InputMarshaller.readFactHandles(InputMarshaller.java:277)
>>>  at
>>> org.drools.marshalling.InputMarshaller.readSession(InputMarshaller.java:179)
>>>  at
>>> org.drools.marshalling.DefaultMarshaller.read(DefaultMarshaller.java:58)
>>>  at
>>> org.drools.marshalling.DefaultMarshaller.read(DefaultMarshaller.java:15)
>>>  at
>>> org.drools.reteoo.ReteooRuleBase.readStatefulSession(ReteooRuleBase.java:277)
>>>  at
>>> org.drools.common.AbstractRuleBase.readStatefulSession(AbstractRuleBase.java:321)
>>>  at
>>> com.sample.test.NewMarshallingTest.testSerializationInFile_1(NewMarshallingTest.java:79)
>>>  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>  at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>>>  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>>>  at java.lang.reflect.Method.invoke(Unknown Source)
>>>  at junit.framework.TestCase.runTest(TestCase.java:154)
>>>  at junit.framework.TestCase.runBare(TestCase.java:127)
>>>  at junit.framework.TestResult$1.protect(TestResult.java:106)
>>>  at junit.framework.TestResult.runProtected(TestResult.java:124)
>>>  at junit.framework.TestResult.run(TestResult.java:109)
>>>  at junit.framework.TestCase.run(TestCase.java:118)
>>>  at
>>> org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
>>>  at
>>> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>>>  at
>>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
>>>  at
>>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
>>>  at
>>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
>>>  at
>>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
>>>
>>> With Drools 4.0.7 ... I can serialize a Stateful session & at later
>>> point
>>> of
>>> time I can deserialize that back. For our usecase, the feature is very
>>> critical.
>>>
>>> Does Drools 5.0 support that ?  DefaultMarshaller is not serializable.
>>> So
>>> once a  Stateful session is serialized. At Later point of time, I am not
>>> able to read that back.
>>>
>>> I have attached my test files.
>>>
>>>
>>> Best Regards!
>>> Siddhartha
>>>
>>> _______________________________________________
>>> rules-users mailing list
>>> rules-users at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>
>>>
>>>     
>>
>>   
> 
> 
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
> 
> 

-- 
View this message in context: http://www.nabble.com/Serialization-in-Drools-5.0-M2-tp20314346p20334733.html
Sent from the drools - user mailing list archive at Nabble.com.




More information about the rules-users mailing list