Hazelcast文件的持久性(MapStore实现) [英] Hazelcast file persistence (MapStore implementation)

查看:396
本文介绍了Hazelcast文件的持久性(MapStore实现)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Hazelcast进行群集数据分发.我使用MapStore和MapLoader接口阅读了有关数据持久性的文档.我需要实现这些接口,并将类名写在hazelcast.xml文件中.

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.

是否存在通过hazelcast实现文件持久化的这些接口的实现示例?有人知道我可以下载和使用的任何源代码或jar文件吗?

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?

谢谢

推荐答案

只需使用ObjectOutputStream和ObjectInputStream即可实现自己的实现.

You can implement your own just using ObjectOutputStream and ObjectInputStream.

您可以使用地图名称创建目录. store(key,value)操作创建一个名称为key.dat的文件,其中包含序列化值的内容. load(key)方法将"key.dat"文件读入一个对象并返回.

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.

这里有ObjectOutputStream和ObjectInputStream的用法示例

Here usage examples of ObjectOutputStream and ObjectInputStream

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

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

然后,您应该将此实现类添加到您的类路径中,并在hazelcast.xml中进行设置

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

这篇关于Hazelcast文件的持久性(MapStore实现)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆