Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/378.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Hazelcast缓存中是否有类似于比较和设置的内容?_Java_Caching_Hazelcast - Fatal编程技术网

Java Hazelcast缓存中是否有类似于比较和设置的内容?

Java Hazelcast缓存中是否有类似于比较和设置的内容?,java,caching,hazelcast,Java,Caching,Hazelcast,我需要在缓存中将一些对象粘在一起。我从不同hazelcast节点上的队列接收这些对象 例如 Node 1 receives message "message 1. part 1" Node 2 receives message "message 1. part 2" One of the nodes should send to the output full message 1. @sinedsem,最简单的解决方案是: Value oldValue = imap.get(key) Val

我需要在缓存中将一些对象粘在一起。我从不同hazelcast节点上的队列接收这些对象

例如

Node 1 receives message "message 1. part 1"
Node 2 receives message "message 1. part 2"

One of the nodes should send to the output full message 1.

@sinedsem,最简单的解决方案是:

Value oldValue = imap.get(key)
Value newValue = oldValue;
if (newValue == null) newValue = new Value()
//Either set part1 or part 2 depends on the node
newValue.setPart1(part1)
imap.replace(key, oldValue, newValue)
您也可以检查此示例: