本文整理了Java中com.hazelcast.core.IMap.replace()
方法的一些代码示例,展示了IMap.replace()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IMap.replace()
方法的具体详情如下:
包路径:com.hazelcast.core.IMap
类名称:IMap
方法名:replace
[英]Warning 1:
This method uses hashCode and equals of the binary form of the key, not the actual implementations of hashCode and equalsdefined in the key's class.
Warning 2:
This method returns a clone of the previous value, not the original (identically equal) value previously put into the map.
Interactions with the map store
If write-through persistence mode is configured, before the value is stored in memory, MapStore#store(Object,Object) is called to write the value into the map store. Exceptions thrown by the store fail the operation and are propagated to the caller.
If write-behind persistence mode is configured with write-coalescing turned off, com.hazelcast.map.ReachedMaxSizeException may be thrown if the write-behind queue has reached its per-node maximum capacity.
[中]警告1:
此方法使用密钥二进制形式的hashCode和equals,而不是密钥类中定义的hashCode和equals的实际实现。
警告2:
此方法返回先前值的克隆,而不是先前放入映射的原始(相同相等)值。
与地图商店的交互
如果配置了直写持久化模式,则在将值存储在内存中之前,将调用MapStore#store(对象,对象)将值写入映射存储。存储引发的异常使操作失败,并传播到调用方。
如果将写后持久化模式配置为关闭写合并,则com。黑泽尔卡斯特。地图如果写后队列已达到其每个节点的最大容量,则可能引发ReacheMaxSizeException。
代码示例来源:origin: hazelcast/hazelcast-jet
@Override
public boolean replace(K key, V oldValue, V newValue) {
return map.replace(key, oldValue, newValue);
}
代码示例来源:origin: hazelcast/hazelcast-jet
@Override
public V replace(K key, V newValue) {
return map.replace(key, newValue);
}
代码示例来源:origin: hazelcast/hazelcast-jet
@Override
public boolean replace(K key, V oldValue, V newValue) {
return map.replace(key, oldValue, newValue);
}
代码示例来源:origin: hazelcast/hazelcast-jet
@Override
public V replace(K key, V value) {
return map.replace(key, value);
}
代码示例来源:origin: com.hazelcast/hazelcast-all
@Override
public V replace(K key, V newValue) {
return map.replace(key, newValue);
}
代码示例来源:origin: com.hazelcast/hazelcast-all
@Override
public boolean replace(K key, V oldValue, V newValue) {
return map.replace(key, oldValue, newValue);
}
代码示例来源:origin: com.hazelcast/hazelcast-all
@Override
public Object replace(String mapName, String key, Object value) {
return hazelcast.getMap(mapName).replace(key, value);
}
代码示例来源:origin: hazelcast/hazelcast-jet
@Override
public Object replace(String mapName, String key, Object value) {
return hazelcast.getMap(mapName).replace(key, value);
}
代码示例来源:origin: spring-projects/spring-integration-extensions
@Override
public boolean replace(String key, String oldValue, String newValue) {
Assert.notNull(key, "'key' must not be null.");
Assert.notNull(oldValue, "'oldValue' must not be null.");
Assert.notNull(newValue, "'newValue' must not be null.");
return this.map.replace(key, oldValue, newValue);
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
public void run() {
IMap map = hazelcast.getMap("myMap");
map.replace(random.nextInt(SIZE), new Customer(random.nextInt(100), String.valueOf(random.nextInt(10000))));
}
}, 4);
代码示例来源:origin: hazelcast/hazelcast-code-samples
public void run() {
IMap map = hazelcast.getMap("myMap");
map.replace(random.nextInt(SIZE), new Customer(random.nextInt(100), String.valueOf(random.nextInt(10000))),
new Customer(random.nextInt(100), String.valueOf(random.nextInt(10000))));
}
}, 5);
代码示例来源:origin: com.atlassian.cache/atlassian-cache-hazelcast
@Override
public boolean replace(@Nonnull K key, @Nonnull V oldValue, @Nonnull V newValue)
{
return map.replace(checkNotNull(key, "key"),
wrap(checkNotNull(oldValue, "oldValue")), wrap(checkNotNull(newValue, "newValue")));
}
代码示例来源:origin: org.apache.camel/camel-hazelcast
/**
* UPDATE an object in your cache (the whole object will be replaced)
*/
private void update(Object oid, Exchange exchange) {
Object body = exchange.getIn().getBody();
this.cache.lock(oid);
this.cache.replace(oid, body);
this.cache.unlock(oid);
}
代码示例来源:origin: org.apache.camel/camel-hazelcast
/**
* Replaces the entry for given id with a specific value in the body, only if currently mapped to a given value
*/
private void update(Object oid, Object ovalue, Exchange exchange) {
Object body = exchange.getIn().getBody();
this.cache.lock(oid);
this.cache.replace(oid, ovalue, body);
this.cache.unlock(oid);
}
代码示例来源:origin: orientechnologies/spring-data-orientdb
@Override
public void update(Session session) throws UnknownSessionException {
log.debug("Updating a session identified by[{}]", session.getId());
map.replace(session.getId(), session);
}
代码示例来源:origin: org.apache.camel/camel-hazelcast
@Override
public boolean confirm(String key) {
repo.lock(key);
try {
return repo.replace(key, false, true);
} finally {
repo.unlock(key);
}
}
代码示例来源:origin: com.hazelcast/hazelcast-all
protected void handleMapReplace(String[] args) {
println(getMap().replace(args[1], args[2]));
}
代码示例来源:origin: hazelcast/hazelcast-jet
protected void handleMapReplace(String[] args) {
println(getMap().replace(args[1], args[2]));
}
代码示例来源:origin: com.hazelcast/hazelcast-all
protected void handleMapReplace(String[] args) {
println(getMap().replace(args[1], args[2]));
}
代码示例来源:origin: com.hazelcast.simulator/tests-common
@TimeStep
public void timeStep(ThreadState state) throws Exception {
Integer key = state.randomInt(keyCount);
long incrementValue = state.randomInt(100);
for (; ; ) {
Long current = map.get(key);
Long update = current + incrementValue;
if (map.replace(key, current, update)) {
state.increment(key, incrementValue);
break;
}
}
}
内容来源于网络,如有侵权,请联系作者删除!