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

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

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

IMap.getLocalMapStats介绍

[英]Returns LocalMapStats for this map.

LocalMapStats are the statistics for the local portion of this distributed map and contains information such as ownedEntryCount backupEntryCount, lastUpdateTime, lockedEntryCount.

Since this stats are only for the local portion of this map, if you need the cluster-wide MapStats then you need to get the LocalMapStats from all members of the cluster and combine them.

It's guaranteed that the returned LocalMapStats instance contains an up-to-date statistics. But over the time some parts of the returned instance may become stale while others may be updated. To obtain a fresh up-to-date instance invoke the method one more time.
[中]返回此映射的LocalMapStats。
LocalMapStats是此分布式映射的本地部分的统计信息,包含ownedEntryCount backupEntryCount、lastUpdateTime、lockedEntryCount等信息。
由于此统计信息仅用于此映射的本地部分,因此如果需要集群范围的MapStats,则需要从集群的所有成员获取LocalMapStats并将其组合。
可以保证返回的LocalMapStats实例包含最新的统计信息。但随着时间的推移,返回实例的某些部分可能会过时,而其他部分可能会更新。要获取最新的实例,请再次调用该方法。

代码示例

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

@Override
public LocalMapStats getLocalMapStats() {
  return map.getLocalMapStats();
}

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

@Override
  public LocalMapStats get() {
    return map.getLocalMapStats();
  }
}

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

@Override
  public LocalMapStats get() {
    return map.getLocalMapStats();
  }
}

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

@Override
public LocalMapStats getLocalMapStats() {
  return map.getLocalMapStats();
}

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

@Override
public LocalMapStats getLocalMapStats() {
  return map.getLocalMapStats();
}

代码示例来源:origin: OpenWiseSolutions/openhub-framework

@Override
@Nullable
String getCacheInfo() {
  IMap<Object, Object> map = hazelcast.getMap(CacheNames.THROTTLING);
  return "Throttling Hazelcast statistics dump:\n" + map.getLocalMapStats().toString();
}

代码示例来源:origin: org.sakaiproject.kernel/sakai-kernel-impl

@Override
public String getDescription() {
  return "HCMap("+getName()+"):"+cache.getLocalMapStats(); // TODO we really want the cluster stats
}

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

private void mapStats() {
  log(hazelcast.getMap("myMap").getLocalMapStats());
}

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

private static long totalEntryCountOnNode(String name, HazelcastInstance instance) {
  IMap map = instance.getMap(name);
  LocalMapStats localMapStats = map.getLocalMapStats();
  long ownedEntryCount = localMapStats.getOwnedEntryCount();
  long backupEntryCount = localMapStats.getBackupEntryCount();
  return ownedEntryCount + backupEntryCount;
}

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

@Override
public Long call() throws Exception {
  
  IMap<Long, Document> xddCache = hzInstance.getMap(CN_XDM_DOCUMENT);
  IMap<DataKey, Element> xdmCache = hzInstance.getMap(CN_XDM_ELEMENT);
  
  LocalMapStats stats = xddCache.getLocalMapStats();
  long size = stats.getBackupEntryMemoryCost() + stats.getOwnedEntryMemoryCost();
  stats = xdmCache.getLocalMapStats();
  size += stats.getBackupEntryMemoryCost() + stats.getOwnedEntryMemoryCost();
  return size; 
}

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

@SuppressWarnings("SameParameterValue")
protected static void waitForNearCacheEvictionCount(IMap<?, Article> map, int expectedEvictionCount) {
  long evictionCount;
  do {
    NearCacheStats stats = map.getLocalMapStats().getNearCacheStats();
    evictionCount = stats.getEvictions();
  } while (evictionCount > expectedEvictionCount);
}

代码示例来源:origin: io.snamp/internal-services

@Override
public int getVersion() {
  if (detached)
    throw detachedException();
  return (int) distributedMap.getLocalMapStats().getPutOperationCount();
}

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

protected static void printNearCacheStats(IMap<?, Article> map) {
  NearCacheStats stats = map.getLocalMapStats().getNearCacheStats();
  System.out.printf("The Near Cache contains %d entries.%n", stats.getOwnedEntryCount());
  System.out.printf("The first article instance was retrieved from the remote instance (Near Cache misses: %d).%n",
      stats.getMisses());
  System.out.printf(
      "The second and third article instance were retrieved from the local Near Cache (Near Cache hits: %d).%n",
      stats.getHits());
}

代码示例来源:origin: stackoverflow.com

IMap map = Hazelcast.getMap("test");
for (int i = 0; i < 100; i++) {
  map.put(i, i);
  map.get(i);
}
LocalMapStats stats = map.getLocalMapStats();
System.err.println(stats.getHits());
System.err.println(stats.getOwnedEntryCount());

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

public static void main(String[] args) {
  HazelcastInstance node = Hazelcast.newHazelcastInstance(newConfig());
  IMap<String, String> map = node.getMap("default");
  for (int i = 0; i < 1000; i++) {
    map.put("key-" + i, "value-" + i);
  }
  // first get() populates the Near cache with the remote entry
  for (int i = 0; i < 1000; i++) {
    map.get("key-" + i);
  }
  long ownedEntryCount = map.getLocalMapStats().getNearCacheStats().getOwnedEntryCount();
  System.out.println("Near Cache includes " + ownedEntryCount + " entries");
  node.shutdown();
}

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

private void handStats(String[] args) {
  String iteratorStr = args[0];
  if (iteratorStr.startsWith("m.")) {
    println(getMap().getLocalMapStats());
  } else if (iteratorStr.startsWith("mm.")) {
    println(getMultiMap().getLocalMultiMapStats());
  } else if (iteratorStr.startsWith("q.")) {
    println(getQueue().getLocalQueueStats());
  }
}

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

private void handStats(String[] args) {
  String iteratorStr = args[0];
  if (iteratorStr.startsWith("m.")) {
    println(getMap().getLocalMapStats());
  } else if (iteratorStr.startsWith("mm.")) {
    println(getMultiMap().getLocalMultiMapStats());
  } else if (iteratorStr.startsWith("q.")) {
    println(getQueue().getLocalQueueStats());
  }
}

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

private void handStats(String[] args) {
  String iteratorStr = args[0];
  if (iteratorStr.startsWith("m.")) {
    println(getMap().getLocalMapStats());
  } else if (iteratorStr.startsWith("mm.")) {
    println(getMultiMap().getLocalMultiMapStats());
  } else if (iteratorStr.startsWith("q.")) {
    println(getQueue().getLocalQueueStats());
  }
}

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

private void handStats(String[] args) {
  String iteratorStr = args[0];
  if (iteratorStr.startsWith("m.")) {
    println(getMap().getLocalMapStats());
  } else if (iteratorStr.startsWith("mm.")) {
    println(getMultiMap().getLocalMultiMapStats());
  } else if (iteratorStr.startsWith("q.")) {
    println(getQueue().getLocalQueueStats());
  }
}

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

protected static void printNearCacheStats(IMap<?, Article> map, String message) {
  NearCacheStats stats = map.getLocalMapStats().getNearCacheStats();
  System.out.printf("%s (%d entries, %d hits, %d misses, %d evictions, %d expirations)%n",
      message, stats.getOwnedEntryCount(), stats.getHits(), stats.getMisses(),
      stats.getEvictions(), stats.getExpirations());
}

相关文章