2
votes

I am using Hazelcast for clustered data distribution. I read in the documentation about data persistence, using the interfaces MapStore and MapLoader. I need to implement these interfaces and write the class name in the hazelcast.xml file.

Is there any example of implementation of these interfaces for file persistence with hazelcast? Does anyone know about any source code or jar file that I can download and work with?

Thanks

1
hello Daniel. Have you implemented or found a working persistence? How have you dealt with what Fuad Malikov said below?ib84

1 Answers

1
votes

You can implement your own just using ObjectOutputStream and ObjectInputStream.

You can create a directory with map's name. store(key, value) operation creates a file with name key.dat, with content of serialized value. load(key) method reads "key.dat" file into an object and returns.

Here usage examples of ObjectOutputStream and ObjectInputStream

http://www.mkyong.com/java/how-to-write-an-object-to-file-in-java/

http://www.mkyong.com/java/how-to-read-an-object-from-file-in-java/

Then you should add this implementation class to your class path and set it in your hazelcast.xml