[
https://jira.jboss.org/jira/browse/JBRULES-2048?page=com.atlassian.jira.p...
]
Michal Bali commented on JBRULES-2048:
--------------------------------------
Thanks for the explanation, it makes more sense why it is happening.
object references are not shared when deserialized
--------------------------------------------------
Key: JBRULES-2048
URL:
https://jira.jboss.org/jira/browse/JBRULES-2048
Project: JBoss Drools
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: drools-compiler (expert)
Affects Versions: 5.0.0.CR1
Environment: 1.6.0_10
Reporter: Michal Bali
Assignee: Mark Proctor
Fix For: FUTURE
Attachments: patch to rev 25427.txt
Hi,
The java.io.ObjectOutputStream API specifies that: "Multiple references to a single
object are encoded using a reference sharing mechanism so that graphs of objects can be
restored to the same shape as when the original was written. "
Let's say that a knowledge session contains one fact. We serialize the knowledge
session and the fact into one output stream. Then deserialize the session and the fact.
The object references will be different. In my opinion this is a bug.
Attached is a unit test to show this.
Example use case:
This can happen for example if the stateful knowledge session is stored within a HTTP
servlet session. The HTTP servlet session can contain other objects that are part of the
stateful knowledge session. When the HTTP servlet session is serialized and deserialized
the object references will be different and it is for example no longer possible to do
session.getFactHandleByIdentity(...).
Please note that this issue might be fixed by fixing JBRULES-1925.
Thank you.
Best Regards,
Michal
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira