Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Externalize TreeMap in B+Trees to fix bug in Infinispan State Transfer
* When storing DomainObjects we need to ensure that they are correctly de-serialized. Otherwise the folowing case occurs: In Infinispan backend we were storing TreeMaps (in B+Trees nodes) directly as Infinispan's cache values). Given that the TreeMaps were Serializable, they were being correctly sent to other nodes by Infinispan's state transfer mechanism. E.g. when a new node is created and FenixFramework's auto-initialization process occurs, the new cache will receive the updates. When some updated entries hold a reference to a Domain Object (as is the case with TreeMaps in B+Trees nodes), they will be deserialized by invoking FenixFramework.getDomainObject(). However, this invocation occurs in the context of an initialization of the FenixFramework class, that is still running the static initializer's code. Because of this the classloader is still holding a lock that prevents the other thread from executing FenixFramework.getDomainObject. The solution for this problem is to serialize/deserialize the TreeMap when they are being stored in the node's slot. NOTE: Should a programmer decide to create a DML valueType that can internally hold a DomainObject, the programmer is responsible for deciding how to store such value-type. The safest way (at least for Infinispan) is to serialize/deserialize that DomainObject when setting/getting it , so that it doesn't get stored directly, but serialized instead.
- Loading branch information