Search in sources :

Example 21 with CacheStatistics

use of com.hazelcast.cache.CacheStatistics in project hazelcast by hazelcast.

the class TimedMemberStateFactory method createMemState.

private void createMemState(TimedMemberState timedMemberState, MemberStateImpl memberState, Collection<StatisticsAwareService> services) {
    int count = 0;
    Config config = instance.getConfig();
    Set<String> longInstanceNames = new HashSet<String>(maxVisibleInstanceCount);
    for (StatisticsAwareService service : services) {
        if (count < maxVisibleInstanceCount) {
            if (service instanceof MapService) {
                count = handleMap(memberState, count, config, ((MapService) service).getStats(), longInstanceNames);
            } else if (service instanceof MultiMapService) {
                count = handleMultimap(memberState, count, config, ((MultiMapService) service).getStats(), longInstanceNames);
            } else if (service instanceof QueueService) {
                count = handleQueue(memberState, count, config, ((QueueService) service).getStats(), longInstanceNames);
            } else if (service instanceof TopicService) {
                count = handleTopic(memberState, count, config, ((TopicService) service).getStats(), longInstanceNames);
            } else if (service instanceof DistributedExecutorService) {
                count = handleExecutorService(memberState, count, config, ((DistributedExecutorService) service).getStats(), longInstanceNames);
            } else if (service instanceof ReplicatedMapService) {
                count = handleReplicatedMap(memberState, count, config, ((ReplicatedMapService) service).getStats(), longInstanceNames);
            }
        }
    }
    WanReplicationService wanReplicationService = instance.node.nodeEngine.getWanReplicationService();
    Map<String, LocalWanStats> wanStats = wanReplicationService.getStats();
    if (wanStats != null) {
        count = handleWan(memberState, count, wanStats, longInstanceNames);
    }
    if (cacheServiceEnabled) {
        ICacheService cacheService = getCacheService();
        for (CacheConfig cacheConfig : cacheService.getCacheConfigs()) {
            if (cacheConfig.isStatisticsEnabled() && count < maxVisibleInstanceCount) {
                CacheStatistics statistics = cacheService.getStatistics(cacheConfig.getNameWithPrefix());
                //is filled.git
                if (statistics != null) {
                    count = handleCache(memberState, count, cacheConfig, statistics, longInstanceNames);
                }
            }
        }
    }
    timedMemberState.setInstanceNames(longInstanceNames);
}
Also used : StatisticsAwareService(com.hazelcast.spi.StatisticsAwareService) CacheConfig(com.hazelcast.config.CacheConfig) Config(com.hazelcast.config.Config) GroupConfig(com.hazelcast.config.GroupConfig) MultiMapService(com.hazelcast.multimap.impl.MultiMapService) ReplicatedMapService(com.hazelcast.replicatedmap.impl.ReplicatedMapService) QueueService(com.hazelcast.collection.impl.queue.QueueService) WanReplicationService(com.hazelcast.wan.WanReplicationService) CacheStatistics(com.hazelcast.cache.CacheStatistics) TopicService(com.hazelcast.topic.impl.TopicService) ICacheService(com.hazelcast.cache.impl.ICacheService) LocalWanStats(com.hazelcast.monitor.LocalWanStats) DistributedExecutorService(com.hazelcast.executor.impl.DistributedExecutorService) MultiMapService(com.hazelcast.multimap.impl.MultiMapService) ReplicatedMapService(com.hazelcast.replicatedmap.impl.ReplicatedMapService) MapService(com.hazelcast.map.impl.MapService) CacheConfig(com.hazelcast.config.CacheConfig) HashSet(java.util.HashSet)

Example 22 with CacheStatistics

use of com.hazelcast.cache.CacheStatistics in project hazelcast by hazelcast.

the class ClientCacheStatsTest method testNearCacheStatsWhenNearCacheEnabled.

@Test
public void testNearCacheStatsWhenNearCacheEnabled() {
    String cacheName = randomName();
    CacheConfig cacheConfig = createCacheConfig();
    cacheConfig.setName(cacheName);
    ClientConfig clientConfig = ((HazelcastClientProxy) client).getClientConfig();
    clientConfig.addNearCacheConfig(new NearCacheConfig().setName(cacheName));
    ICache<Integer, String> cache = createCache(cacheName, cacheConfig);
    CacheStatistics stats = cache.getLocalCacheStatistics();
    assertNotNull(stats.getNearCacheStatistics());
}
Also used : CacheStatistics(com.hazelcast.cache.CacheStatistics) NearCacheConfig(com.hazelcast.config.NearCacheConfig) ClientConfig(com.hazelcast.client.config.ClientConfig) HazelcastClientProxy(com.hazelcast.client.impl.HazelcastClientProxy) CacheConfig(com.hazelcast.config.CacheConfig) NearCacheConfig(com.hazelcast.config.NearCacheConfig) QuickTest(com.hazelcast.test.annotation.QuickTest) CacheStatsTest(com.hazelcast.cache.stats.CacheStatsTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Aggregations

CacheStatistics (com.hazelcast.cache.CacheStatistics)22 ParallelTest (com.hazelcast.test.annotation.ParallelTest)19 QuickTest (com.hazelcast.test.annotation.QuickTest)19 Test (org.junit.Test)19 CacheConfig (com.hazelcast.config.CacheConfig)3 JsonObject (com.eclipsesource.json.JsonObject)1 ICacheService (com.hazelcast.cache.impl.ICacheService)1 CacheStatsTest (com.hazelcast.cache.stats.CacheStatsTest)1 ClientConfig (com.hazelcast.client.config.ClientConfig)1 HazelcastClientProxy (com.hazelcast.client.impl.HazelcastClientProxy)1 QueueService (com.hazelcast.collection.impl.queue.QueueService)1 Config (com.hazelcast.config.Config)1 GroupConfig (com.hazelcast.config.GroupConfig)1 NearCacheConfig (com.hazelcast.config.NearCacheConfig)1 HazelcastInstance (com.hazelcast.core.HazelcastInstance)1 DistributedExecutorService (com.hazelcast.executor.impl.DistributedExecutorService)1 MapService (com.hazelcast.map.impl.MapService)1 LocalWanStats (com.hazelcast.monitor.LocalWanStats)1 MultiMapService (com.hazelcast.multimap.impl.MultiMapService)1 ReplicatedMapService (com.hazelcast.replicatedmap.impl.ReplicatedMapService)1