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()); }
@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); }
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()); }
protected static void printNearCacheStats(ICache<Integer, Article> cache) { NearCacheStats stats = cache.getLocalCacheStatistics().getNearCacheStatistics(); 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()); }
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(); }
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());
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; }
@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; }
private NearCacheStats getNearCacheStats(LocalInstanceStats localInstanceStats) { if (localInstanceStats instanceof LocalMapStatsImpl) { LocalMapStats localMapStats = (LocalMapStats) localInstanceStats; return localMapStats.getNearCacheStats(); } else if (localInstanceStats instanceof CacheStatistics) { CacheStatistics localMapStats = (CacheStatistics) localInstanceStats; return localMapStats.getNearCacheStatistics(); } else { return null; } }
@ManagedAnnotation("state") @ManagedDescription("State of the WAN replication publisher") public String getState() { final Map<String, LocalWanStats> wanStats = managedObject.getStats(); if (wanStats == null) { return ""; } final LocalWanStats wanReplicationStats = wanStats.get(wanReplicationName); final Map<String, LocalWanPublisherStats> wanDelegatingPublisherStats = wanReplicationStats.getLocalWanPublisherStats(); final LocalWanPublisherStats wanPublisherStats = wanDelegatingPublisherStats.get(targetGroupName); return wanPublisherStats.getPublisherState().name(); }
@ManagedAnnotation("localHits") @ManagedDescription("the number of hits (reads) of the locally owned entries.") public long getLocalHits() { return localMapStatsDelegate.getLocalStats().getHits(); }
@Override public int getVersion() { if (detached) throw detachedException(); return (int) distributedMap.getLocalMapStats().getPutOperationCount(); }
@ManagedAnnotation("localMaxGetLatency") @ManagedDescription("the maximum latency of get operations. To get the average latency, divide to number of gets") public long getLocalMaxGetLatency() { return managedObject.getReplicatedMapStats().getMaxGetLatency(); }
@ManagedAnnotation("localMaxRemoveLatency") @ManagedDescription("the maximum latency of remove operations. To get the average latency, divide to number of gets") public long getMaxRemoveLatency() { return localMapStatsDelegate.getLocalStats().getMaxRemoveLatency(); }
@ManagedAnnotation("localPendingTaskCount") @ManagedDescription("the number of pending operations of this executor service on this member") public long getLocalPendingTaskCount() { return managedObject.getLocalExecutorStats().getPendingTaskCount(); }
@ManagedAnnotation("localStartedTaskCount") @ManagedDescription(" the number of started operations of this executor service on this member") public long getLocalStartedTaskCount() { return managedObject.getLocalExecutorStats().getStartedTaskCount(); }
@ManagedAnnotation("localTotalExecutionLatency") @ManagedDescription("the total execution time of operations finished of this executor on this member") public long getLocalTotalExecutionLatency() { return managedObject.getLocalExecutorStats().getTotalExecutionLatency(); }
@ManagedAnnotation("localReceiveOperationCount") @ManagedDescription("the total number of received messages of this reliable topic on this member") public long getLocalReceiveOperationCount() { return managedObject.getLocalTopicStats().getReceiveOperationCount(); }
private NearCacheStats getNearCacheStats(LocalInstanceStats localInstanceStats) { if (localInstanceStats instanceof LocalMapStatsImpl) { LocalMapStats localMapStats = (LocalMapStats) localInstanceStats; return localMapStats.getNearCacheStats(); } else if (localInstanceStats instanceof CacheStatistics) { CacheStatistics localMapStats = (CacheStatistics) localInstanceStats; return localMapStats.getNearCacheStatistics(); } else { return null; } }
@ManagedAnnotation("state") @ManagedDescription("State of the WAN replication publisher") public String getState() { final Map<String, LocalWanStats> wanStats = managedObject.getStats(); if (wanStats == null) { return ""; } final LocalWanStats wanReplicationStats = wanStats.get(wanReplicationName); final Map<String, LocalWanPublisherStats> wanDelegatingPublisherStats = wanReplicationStats.getLocalWanPublisherStats(); final LocalWanPublisherStats wanPublisherStats = wanDelegatingPublisherStats.get(targetGroupName); return wanPublisherStats.getPublisherState().name(); }