serializationhazelcastnotserializableexception

Hazelcast : NotSerializableException


I am using a map with Hazelcast :

//When I do :

map.put(gen.newId(), myObject);

myObject is a very complex object and does not implements Serializable.

I thought that putting the config like below was enough for not having to implement serializable :

<map name="myMap">
    <in-memory-format>OBJECT</in-memory-format>   
</map>

The Hazelcast doc says : http://docs.hazelcast.org/docs/3.5/manual/html/entryprocessor.html "When it is stored as an object (OBJECT format), then the entry processor is applied directly on the object. In that case, no serialization or deserialization is performed"

Thanks for any suggestion.


Solution

  • Unfortunately the object will always be deserialized when the map.put is called, no matter the in memory format. This is because normally there are backups and they need to receive a copy as well. So in this case your only way out is to make your object 'serializable'. You can use Java serialization, but you can also rely on something like Kryo to deal with complex object graphs.