Search in sources :

Example 1 with LocalTopicStats

use of com.hazelcast.topic.LocalTopicStats in project hazelcast by hazelcast.

the class ReliableTopicService method getStats.

@Override
public Map<String, LocalTopicStats> getStats() {
    Map<String, LocalTopicStats> topicStats = MapUtil.createHashMap(statsMap.size());
    Config config = nodeEngine.getConfig();
    for (Map.Entry<String, LocalTopicStatsImpl> queueStat : statsMap.entrySet()) {
        String name = queueStat.getKey();
        if (config.getReliableTopicConfig(name).isStatisticsEnabled()) {
            topicStats.put(name, queueStat.getValue());
        }
    }
    return topicStats;
}
Also used : Config(com.hazelcast.config.Config) ReliableTopicConfig(com.hazelcast.config.ReliableTopicConfig) LocalTopicStatsImpl(com.hazelcast.internal.monitor.impl.LocalTopicStatsImpl) LocalTopicStats(com.hazelcast.topic.LocalTopicStats) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) ConcurrentMap(java.util.concurrent.ConcurrentMap) Map(java.util.Map)

Example 2 with LocalTopicStats

use of com.hazelcast.topic.LocalTopicStats in project hazelcast by hazelcast.

the class TopicService method getStats.

@Override
public Map<String, LocalTopicStats> getStats() {
    Map<String, LocalTopicStats> topicStats = MapUtil.createHashMap(statsMap.size());
    Config config = nodeEngine.getConfig();
    for (Map.Entry<String, LocalTopicStatsImpl> statEntry : statsMap.entrySet()) {
        String name = statEntry.getKey();
        if (config.getTopicConfig(name).isStatisticsEnabled()) {
            topicStats.put(name, statEntry.getValue());
        }
    }
    return topicStats;
}
Also used : TopicConfig(com.hazelcast.config.TopicConfig) Config(com.hazelcast.config.Config) LocalTopicStatsImpl(com.hazelcast.internal.monitor.impl.LocalTopicStatsImpl) LocalTopicStats(com.hazelcast.topic.LocalTopicStats) ConcurrentMap(java.util.concurrent.ConcurrentMap) Map(java.util.Map) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap)

Example 3 with LocalTopicStats

use of com.hazelcast.topic.LocalTopicStats in project Payara by payara.

the class EventBus method collect.

@Override
public void collect(MonitoringDataCollector rootCollector) {
    MonitoringDataCollector eventCollector = rootCollector.in("topic");
    if (hzCore.isEnabled()) {
        HazelcastInstance hz = hzCore.getInstance();
        for (DistributedObject obj : hz.getDistributedObjects()) {
            if (TopicService.SERVICE_NAME.equals(obj.getServiceName())) {
                LocalTopicStats stats = hz.getTopic(obj.getName()).getLocalTopicStats();
                eventCollector.group(obj.getName()).collect("PublishedCount", stats.getPublishOperationCount()).collect("ReceiveedCount", stats.getReceiveOperationCount());
            }
        }
    }
}
Also used : MonitoringDataCollector(fish.payara.monitoring.collect.MonitoringDataCollector) DistributedObject(com.hazelcast.core.DistributedObject) HazelcastInstance(com.hazelcast.core.HazelcastInstance) LocalTopicStats(com.hazelcast.topic.LocalTopicStats)

Example 4 with LocalTopicStats

use of com.hazelcast.topic.LocalTopicStats in project hazelcast by hazelcast.

the class ReliableTopicMBeanTest method testAttributesAndOperations.

@Test
public void testAttributesAndOperations() throws Exception {
    reliableTopic.publish("test");
    assertTrueEventually(new AssertTask() {

        @Override
        public void run() throws Exception {
            LocalTopicStats topicStats = reliableTopic.getLocalTopicStats();
            long localCreationTime = getLongAttribute("localCreationTime");
            long localPublishOperationCount = getLongAttribute("localPublishOperationCount");
            long localReceiveOperationCount = getLongAttribute("localReceiveOperationCount");
            assertEquals(topicStats.getCreationTime(), localCreationTime);
            assertEquals(topicStats.getPublishOperationCount(), localPublishOperationCount);
            assertEquals(topicStats.getReceiveOperationCount(), localReceiveOperationCount);
        }
    });
}
Also used : LocalTopicStats(com.hazelcast.topic.LocalTopicStats) AssertTask(com.hazelcast.test.AssertTask) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

LocalTopicStats (com.hazelcast.topic.LocalTopicStats)4 Config (com.hazelcast.config.Config)2 LocalTopicStatsImpl (com.hazelcast.internal.monitor.impl.LocalTopicStatsImpl)2 Map (java.util.Map)2 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)2 ConcurrentMap (java.util.concurrent.ConcurrentMap)2 ReliableTopicConfig (com.hazelcast.config.ReliableTopicConfig)1 TopicConfig (com.hazelcast.config.TopicConfig)1 DistributedObject (com.hazelcast.core.DistributedObject)1 HazelcastInstance (com.hazelcast.core.HazelcastInstance)1 AssertTask (com.hazelcast.test.AssertTask)1 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)1 QuickTest (com.hazelcast.test.annotation.QuickTest)1 MonitoringDataCollector (fish.payara.monitoring.collect.MonitoringDataCollector)1 Test (org.junit.Test)1