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

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

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

IMap.addLocalEntryListener介绍

[英]Adds a local entry listener for this map. The added listener will only be listening for the events (add/remove/update/evict) of the locally owned entries.

Note that entries in distributed map are partitioned across the cluster members; each member owns and manages the some portion of the entries. Owned entries are called local entries. This listener will be listening for the events of local entries. Let's say your cluster has member1 and member2. On member2 you added a local listener and from member1, you call map.put(key2, value2). If the key2 is owned by member2 then the local listener will be notified for the add/update event. Also note that entries can migrate to other nodes for load balancing and/or membership change.
[中]为此映射添加本地条目侦听器。添加的侦听器将只侦听本地拥有的条目的事件(添加/删除/更新/逐出)。
注意,分布式映射中的条目是跨集群成员进行分区的;每个成员都拥有并管理部分条目。拥有的条目称为本地条目。此侦听器将侦听本地条目的事件。假设您的集群有member1和member2。在member2上添加了一个本地侦听器,并从member1调用map。输入(键2,值2)。如果key2归member2所有,则本地侦听器将收到添加/更新事件的通知。还请注意,条目可以迁移到其他节点以实现负载平衡和/或成员资格更改。

代码示例

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

@Override
public String addLocalEntryListener(EntryListener listener, Predicate<K, V> predicate, K key,
                  boolean includeValue) {
  return map.addLocalEntryListener(listener, predicate, key, includeValue);
}

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

@Override
public String addLocalEntryListener(EntryListener listener, Predicate<K, V> predicate, boolean includeValue) {
  return map.addLocalEntryListener(listener, predicate, includeValue);
}

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

@Override
public String addLocalEntryListener(MapListener listener) {
  return map.addLocalEntryListener(listener);
}

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

@Override
public String addLocalEntryListener(EntryListener listener) {
  return map.addLocalEntryListener(listener);
}

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

@Override
public String addLocalEntryListener(MapListener listener, Predicate<K, V> predicate, boolean includeValue) {
  return map.addLocalEntryListener(listener, predicate, includeValue);
}

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

@Override
public String addLocalEntryListener(MapListener listener, Predicate<K, V> predicate, K key, boolean includeValue) {
  return map.addLocalEntryListener(listener, predicate, key, includeValue);
}

代码示例来源:origin: dsukhoroslov/bagri

public void setDocumentCache(IMap<DocumentKey, Document> cache) {
  this.docCache = cache;
  docCache.addLocalEntryListener(this);
}

代码示例来源:origin: kloiasoft/eventapis

@Bean
public IMap<String, Topology> operationsMap(@Autowired @Qualifier("hazelcastInstance") HazelcastInstance hazelcastInstance, OperationExpirationListener operationExpirationListener) {
  IMap<String, Topology> operationsMap = hazelcastInstance.getMap(OPERATIONS_MAP_NAME);
  operationsMap.addLocalEntryListener(operationExpirationListener);
  return operationsMap;
}

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

@Bean
  public HazelcastInstance hazelcastInstance(CommandListener commandListener, JetInstance jetInstance) {
    HazelcastInstance hazelcastInstance = jetInstance.getHazelcastInstance();

    // React to map changes
    IMap<?, ?> commandMap = hazelcastInstance.getMap(Constants.IMAP_NAME_COMMAND);
    commandMap.addLocalEntryListener(commandListener);

    // Add in, if we want to trace map changes
    IMap<?, ?> preciousMap =
        hazelcastInstance.getMap(Constants.IMAP_NAME_PRECIOUS);
    preciousMap.addLocalEntryListener(new LoggingListener());

    return hazelcastInstance;
  }
}

代码示例来源:origin: hazelcast/hazelcast-code-samples

public void run() {
    IMap map = hazelcast.getMap("myMap");
    final CountDownLatch latch = new CountDownLatch(1);
    EntryListener listener = new EntryAdapter() {
      @Override
      public void onEntryEvent(EntryEvent event) {
        latch.countDown();
      }
    };
    String id = map.addLocalEntryListener(listener);
    try {
      latch.await();
    } catch (InterruptedException e) {
      throw new RuntimeException(e);
    }
    map.removeEntryListener(id);
  }
}, 1);

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

this.sessionMap.addLocalEntryListener(new EntryListener<String, HazelcastSession>()

相关文章