Reputation: 203
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
Upvotes: 2
Views: 4422
Reputation: 3133
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
Upvotes: 1