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

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

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

IMap.localKeySet介绍

[英]Returns the locally owned set of keys.

Each key in this map is owned and managed by a specific member in the cluster.

Note that ownership of these keys might change over time so that key ownerships can be almost evenly distributed in the cluster.

Warning:

The set is NOT backed by the map, so changes to the map are NOT reflected in the set, and vice-versa.

This method is always executed by a distributed query, so it may throw a QueryResultSizeExceededExceptionif GroupProperty#QUERY_RESULT_SIZE_LIMIT is configured.
[中]返回本地拥有的密钥集。
此映射中的每个密钥都由群集中的特定成员拥有和管理。
请注意,这些密钥的所有权可能会随着时间的推移而改变,以便密钥所有权可以在集群中几乎均匀地分布。
警告:
该集合不受映射的支持,因此对映射的更改不会反映在集合中,反之亦然。
此方法始终由分布式查询执行,因此如果配置了GroupProperty#query#RESULT _SIZE(查询结果)SIZE(大小)限制,则可能会抛出QueryResultSizeExceededException。

代码示例

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

@Override
public Set<K> localKeySet(Predicate predicate) {
  return map.localKeySet(predicate);
}

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

@Override
public Set<K> localKeySet() {
  return map.localKeySet();
}

代码示例来源:origin: jclawson/hazeltask

@Override
public Integer getValue() {
  return map.localKeySet().size();
}

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

public int getKeyCount() {
  return keyCache.localKeySet().size();
}

代码示例来源:origin: jclawson/hazeltask

public int getLocalPendingTaskMapSize() {
  return pendingTask.localKeySet().size();
}

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

public void run() {
    IMap map = hz.getMap("map");
    boolean localKey = map.localKeySet().contains(key);
    System.out.println("Key " + key + " is local: " + localKey);
  }
}

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

public void run() {
    IMap map = hazelcast.getMap("myMap");
    Iterator it = map.localKeySet().iterator();
    while (it.hasNext()) {
      it.next();
    }
  }
}, 10);

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

public void run() {
    IMap map = hazelcast.getMap("myMap");
    Iterator it = map.localKeySet(new SqlPredicate("name=" + random.nextInt(10000))).iterator();
    while (it.hasNext()) {
      it.next();
    }
  }
}, 10);

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

public Integer call() throws Exception {
    IMap<String, Integer> map = hz.getMap("map");
    int result = 0;
    for (String key : map.localKeySet()) {
      System.out.println("Calculating for key: " + key);
      result += map.get(key);
    }
    System.out.println("Local result: " + result);
    return result;
  }
}

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

public void adjustTxCounter(long maxUsedId) {
  Set<Long> ids = new HashSet<>(txCache.localKeySet());
  if (maxUsedId > 0) {
    ids.add(maxUsedId);
  }
  if (ids.size() > 0) {
    Long maxId = Collections.max(ids);
    boolean adjusted = txGen.adjust(maxId);
    logger.info("adjustTxCounter; found maxTxId: {}; adjusted: {}", maxId, adjusted);
  }
}

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

protected void handleMapLocalKeys() {
  Set set = getMap().localKeySet();
  Iterator it = set.iterator();
  int count = 0;
  while (it.hasNext()) {
    count++;
    println(it.next());
  }
  println("Total " + count);
}

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

protected void handleMapLocalKeys() {
  Set set = getMap().localKeySet();
  Iterator it = set.iterator();
  int count = 0;
  while (it.hasNext()) {
    count++;
    println(it.next());
  }
  println("Total " + count);
}

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

protected void handleMapLocalKeys() {
  Set set = getMap().localKeySet();
  Iterator it = set.iterator();
  int count = 0;
  while (it.hasNext()) {
    count++;
    println(it.next());
  }
  println("Total " + count);
}

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

protected void handleMapLocalKeys() {
  Set set = getMap().localKeySet();
  Iterator it = set.iterator();
  int count = 0;
  while (it.hasNext()) {
    count++;
    println(it.next());
  }
  println("Total " + count);
}

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

protected void handleMapLocalSize() {
  println("Local Size = " + getMap().localKeySet().size());
}

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

protected void handleMapLocalSize() {
  println("Local Size = " + getMap().localKeySet().size());
}

代码示例来源:origin: jclawson/hazeltask

public Collection<HazeltaskTask<GROUP>> getLocalPendingTasks(String predicate) {
  Set<UUID> keys = pendingTask.localKeySet(new SqlPredicate(predicate));
  return pendingTask.getAll(keys).values();
}

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

protected void handleMapLocalSize() {
  println("Local Size = " + getMap().localKeySet().size());
}

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

protected void handleMapLocalSize() {
  println("Local Size = " + getMap().localKeySet().size());
}

代码示例来源:origin: com.hazelcast.simulator/tests-common

@Prepare(global = true)
public void prepare() {
  Random random = new Random();
  Streamer<String, DataSerializableEmployee> streamer = StreamerFactory.getInstance(map);
  for (int i = 0; i < keyCount; i++) {
    String key = generateString(keyLength);
    DataSerializableEmployee value = generateRandomEmployee(random);
    streamer.pushEntry(key, value);
  }
  streamer.await();
  logger.info("Map size is: " + map.size());
  logger.info("Map localKeySet size is: " + map.localKeySet().size());
}

相关文章