com.hazelcast.core.IMap.executeOnKeys()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(2.9k)|赞(0)|评价(0)|浏览(136)

本文整理了Java中com.hazelcast.core.IMap.executeOnKeys()方法的一些代码示例,展示了IMap.executeOnKeys()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IMap.executeOnKeys()方法的具体详情如下:
包路径:com.hazelcast.core.IMap
类名称:IMap
方法名:executeOnKeys

IMap.executeOnKeys介绍

[英]Applies the user defined EntryProcessor to the entries mapped by the collection of keys.

The operation is not lock-aware. The EntryProcessor will process the entries no matter if the keys are locked or not. For more details check Entry Processing section on IMap documentation.

Interactions with the map store

For each entry not found in memory MapLoader#load(Object)is invoked to load the value from the map store backing the map.

If write-through persistence mode is configured, for each entry updated by the entryProcessor, before the updated value is stored in memory, MapStore#store(Object,Object) is called to write the value into the map store.

If write-through persistence mode is configured, for each entry updated to null value, before the value is removed from the memory, MapStore#delete(Object) is called to delete the value from the map store.

Any exceptions thrown by the map store fail the operation and are propagated to the caller. If an exception happened, the operation might already succeeded on some of the keys.

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.

Performance note

Keep the state of entryProcessorsmall, it will be serialized and one copy will be sent to each member. Additionally, the EntryProcessor#getBackupProcessor() will also be serialized once for each affected partition and sent to each backup. For example, in this usage the entire additions map will be duplicated once for each member and once for each partition and backup:

HashMap additions = ...;}); 
}

[中]将用户定义的EntryProcessor应用于键集合映射的条目。
该操作不支持锁定。无论钥匙是否锁定,EntryProcessor都将处理这些条目。有关更多详细信息,请查看IMap文档中的条目处理部分。
与地图商店的交互
对于内存中未找到的每个条目,MapLoader#load(Object)被调用以从支持映射的映射存储中加载值。
如果配置了直写持久化模式,则对于entryProcessor更新的每个条目,在更新的值存储在内存中之前,会调用MapStore#store(Object,Object)将值写入map store。
如果配置了直写持久化模式,则对于更新为空值的每个条目,在从内存中删除该值之前,将调用MapStore#delete(Object)从映射存储中删除该值。
映射存储引发的任何异常都会导致操作失败,并传播到调用方。如果发生异常,操作可能已经在某些密钥上成功。
如果将写后持久化模式配置为关闭写合并,则com。黑泽尔卡斯特。地图如果写后队列已达到其每个节点的最大容量,则可能引发ReacheMaxSizeException。
#####业绩说明
保持entryProcessorsmall的状态,它将被序列化,并向每个成员发送一份副本。此外,EntryProcessor#getBackupProcessor()还将为每个受影响的分区序列化一次,并发送到每个备份。例如,在此用法中,整个添加映射将为每个成员复制一次,为每个分区和备份复制一次:

HashMap additions = ...;}); 
}

代码示例

代码示例来源:origin: com.hazelcast/hazelcast-all

@Override
public Map<K, Object> executeOnKeys(Set<K> keys, com.hazelcast.map.EntryProcessor entryProcessor) {
  return map.executeOnKeys(keys, entryProcessor);
}

代码示例来源:origin: hazelcast/hazelcast-jet

@Override
public Map<K, Object> executeOnKeys(Set<K> keys, EntryProcessor entryProcessor) {
  return map.executeOnKeys(keys, entryProcessor);
}

代码示例来源:origin: hazelcast/hazelcast-jet

@Override
public Map<K, Object> executeOnKeys(Set<K> keys, com.hazelcast.map.EntryProcessor entryProcessor) {
  return map.executeOnKeys(keys, entryProcessor);
}

相关文章