开发者

Persistent hash-map, concurrent JDBM

I tested JDBM2 which is really a great API to persist data d开发者_StackOverflowirectly in a tree- or hash-map. On the project site it is written that it does not support concurrent access. So my question is: Are there similar open source APIs for Java available which support concurrent read and write operations?

Thanks


I guess a basic feature the questions implies is inter-jvm communication? If that is the case, I have successfully used hazelcast.

See for example this question that although different has valuable information.


Java has a way of wrapping an existent hash map and returning a synchronized map; however you will have to write the synchronization yourself: Collections#synchronizedMap

It is quite easy to extend an HashMap or implement the Map interface to enforce some synchronization on get() and put(), however iterators are more tricky.

There's also a ConcurrentHashMap but it has some limitations, depending on what you want to do.

The simple approach is to use Collections#synchronizedMap and add the synchronization code yourself.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜