Search in sources :

Example 1 with LocalWanStats

use of com.hazelcast.internal.monitor.LocalWanStats in project hazelcast by hazelcast.

the class TimedMemberStateFactory method createMemState.

private void createMemState(MemberStateImpl memberState, Collection<StatisticsAwareService> services) {
    Config config = instance.getConfig();
    for (StatisticsAwareService service : services) {
        if (service instanceof MapService) {
            handleMap(memberState, ((MapService) service).getStats());
        } else if (service instanceof MultiMapService) {
            handleMultiMap(memberState, ((MultiMapService) service).getStats());
        } else if (service instanceof QueueService) {
            handleQueue(memberState, ((QueueService) service).getStats());
        } else if (service instanceof TopicService) {
            handleTopic(memberState, ((TopicService) service).getStats());
        } else if (service instanceof ReliableTopicService) {
            handleReliableTopic(memberState, ((ReliableTopicService) service).getStats());
        } else if (service instanceof DistributedExecutorService) {
            handleExecutorService(memberState, config, ((DistributedExecutorService) service).getStats());
        } else if (service instanceof DistributedScheduledExecutorService) {
            handleScheduledExecutorService(memberState, config, ((DistributedScheduledExecutorService) service).getStats());
        } else if (service instanceof DistributedDurableExecutorService) {
            handleDurableExecutorService(memberState, config, ((DistributedDurableExecutorService) service).getStats());
        } else if (service instanceof ReplicatedMapService) {
            handleReplicatedMap(memberState, config, ((ReplicatedMapService) service).getStats());
        } else if (service instanceof PNCounterService) {
            handlePNCounter(memberState, config, ((PNCounterService) service).getStats());
        } else if (service instanceof FlakeIdGeneratorService) {
            handleFlakeIdGenerator(memberState, config, ((FlakeIdGeneratorService) service).getStats());
        } else if (service instanceof CacheService) {
            handleCache(memberState, (CacheService) service);
        }
    }
    WanReplicationService wanReplicationService = instance.node.nodeEngine.getWanReplicationService();
    Map<String, LocalWanStats> wanStats = wanReplicationService.getStats();
    if (wanStats != null) {
        handleWan(memberState, wanStats);
    }
}
Also used : DistributedDurableExecutorService(com.hazelcast.durableexecutor.impl.DistributedDurableExecutorService) StatisticsAwareService(com.hazelcast.internal.services.StatisticsAwareService) SocketInterceptorConfig(com.hazelcast.config.SocketInterceptorConfig) ConfigAccessor.getActiveMemberNetworkConfig(com.hazelcast.config.ConfigAccessor.getActiveMemberNetworkConfig) ManagementCenterConfig(com.hazelcast.config.ManagementCenterConfig) CacheConfig(com.hazelcast.config.CacheConfig) SSLConfig(com.hazelcast.config.SSLConfig) Config(com.hazelcast.config.Config) MultiMapService(com.hazelcast.multimap.impl.MultiMapService) ReplicatedMapService(com.hazelcast.replicatedmap.impl.ReplicatedMapService) QueueService(com.hazelcast.collection.impl.queue.QueueService) WanReplicationService(com.hazelcast.wan.impl.WanReplicationService) FlakeIdGeneratorService(com.hazelcast.flakeidgen.impl.FlakeIdGeneratorService) TopicService(com.hazelcast.topic.impl.TopicService) ReliableTopicService(com.hazelcast.topic.impl.reliable.ReliableTopicService) DistributedScheduledExecutorService(com.hazelcast.scheduledexecutor.impl.DistributedScheduledExecutorService) ReliableTopicService(com.hazelcast.topic.impl.reliable.ReliableTopicService) LocalWanStats(com.hazelcast.internal.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) PNCounterService(com.hazelcast.internal.crdt.pncounter.PNCounterService) CacheService(com.hazelcast.cache.impl.CacheService)

Example 2 with LocalWanStats

use of com.hazelcast.internal.monitor.LocalWanStats in project hazelcast by hazelcast.

the class LocalWanStatsImplTest method testSerialization.

@Test
public void testSerialization() {
    LocalWanPublisherStatsImpl tokyo = new LocalWanPublisherStatsImpl();
    tokyo.setConnected(true);
    tokyo.incrementPublishedEventCount(10);
    tokyo.setOutboundQueueSize(100);
    tokyo.setState(WanPublisherState.REPLICATING);
    LocalWanPublisherStatsImpl singapore = new LocalWanPublisherStatsImpl();
    singapore.setConnected(true);
    singapore.setOutboundQueueSize(200);
    singapore.incrementPublishedEventCount(20);
    singapore.setState(WanPublisherState.REPLICATING);
    LocalWanStatsImpl localWanStats = new LocalWanStatsImpl();
    Map<String, LocalWanPublisherStats> localWanPublisherStatsMap = new HashMap<String, LocalWanPublisherStats>();
    localWanPublisherStatsMap.put("tokyo", tokyo);
    localWanPublisherStatsMap.put("singapore", singapore);
    localWanStats.setLocalPublisherStatsMap(localWanPublisherStatsMap);
    JsonObject serialized = localWanStats.toJson();
    LocalWanStats deserialized = new LocalWanStatsImpl();
    ((JsonSerializable) deserialized).fromJson(serialized);
    LocalWanPublisherStats deserializedTokyo = deserialized.getLocalWanPublisherStats().get("tokyo");
    LocalWanPublisherStats deserializedSingapore = deserialized.getLocalWanPublisherStats().get("singapore");
    assertEquals(tokyo.isConnected(), deserializedTokyo.isConnected());
    assertEquals(tokyo.getPublisherState(), deserializedTokyo.getPublisherState());
    assertEquals(singapore.isConnected(), deserializedSingapore.isConnected());
    assertEquals(singapore.getPublisherState(), deserializedSingapore.getPublisherState());
}
Also used : LocalWanPublisherStats(com.hazelcast.internal.monitor.LocalWanPublisherStats) HashMap(java.util.HashMap) LocalWanStats(com.hazelcast.internal.monitor.LocalWanStats) JsonSerializable(com.hazelcast.json.internal.JsonSerializable) JsonObject(com.hazelcast.internal.json.JsonObject) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 3 with LocalWanStats

use of com.hazelcast.internal.monitor.LocalWanStats in project hazelcast by hazelcast.

the class InstanceMBean method registerWanPublisherMBeans.

/**
 * Registers managed beans for all WAN publishers, if any.
 *
 * @param wanReplicationService the WAN replication service
 */
private void registerWanPublisherMBeans(WanReplicationService wanReplicationService) {
    final Map<String, LocalWanStats> wanStats = wanReplicationService.getStats();
    if (wanStats == null) {
        return;
    }
    for (Entry<String, LocalWanStats> replicationStatsEntry : wanStats.entrySet()) {
        final String wanReplicationName = replicationStatsEntry.getKey();
        final LocalWanStats localWanStats = replicationStatsEntry.getValue();
        final Map<String, LocalWanPublisherStats> publisherStats = localWanStats.getLocalWanPublisherStats();
        for (String wanPublisherId : publisherStats.keySet()) {
            register(new WanPublisherMBean(wanReplicationService, wanReplicationName, wanPublisherId, service));
        }
    }
}
Also used : LocalWanPublisherStats(com.hazelcast.internal.monitor.LocalWanPublisherStats) LocalWanStats(com.hazelcast.internal.monitor.LocalWanStats)

Example 4 with LocalWanStats

use of com.hazelcast.internal.monitor.LocalWanStats in project hazelcast by hazelcast.

the class WanPublisherMBean method getState.

@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(wanPublisherId);
    return wanPublisherStats.getPublisherState().name();
}
Also used : LocalWanPublisherStats(com.hazelcast.internal.monitor.LocalWanPublisherStats) LocalWanStats(com.hazelcast.internal.monitor.LocalWanStats)

Example 5 with LocalWanStats

use of com.hazelcast.internal.monitor.LocalWanStats in project hazelcast by hazelcast.

the class TimedMemberStateFactory method handleWan.

private void handleWan(MemberStateImpl memberState, Map<String, LocalWanStats> wans) {
    for (Map.Entry<String, LocalWanStats> entry : wans.entrySet()) {
        String schemeName = entry.getKey();
        LocalWanStats stats = entry.getValue();
        memberState.putLocalWanStats(schemeName, stats);
    }
}
Also used : LocalWanStats(com.hazelcast.internal.monitor.LocalWanStats) Map(java.util.Map) MapUtil.createHashMap(com.hazelcast.internal.util.MapUtil.createHashMap)

Aggregations

LocalWanStats (com.hazelcast.internal.monitor.LocalWanStats)5 LocalWanPublisherStats (com.hazelcast.internal.monitor.LocalWanPublisherStats)3 CacheService (com.hazelcast.cache.impl.CacheService)1 QueueService (com.hazelcast.collection.impl.queue.QueueService)1 CacheConfig (com.hazelcast.config.CacheConfig)1 Config (com.hazelcast.config.Config)1 ConfigAccessor.getActiveMemberNetworkConfig (com.hazelcast.config.ConfigAccessor.getActiveMemberNetworkConfig)1 ManagementCenterConfig (com.hazelcast.config.ManagementCenterConfig)1 SSLConfig (com.hazelcast.config.SSLConfig)1 SocketInterceptorConfig (com.hazelcast.config.SocketInterceptorConfig)1 DistributedDurableExecutorService (com.hazelcast.durableexecutor.impl.DistributedDurableExecutorService)1 DistributedExecutorService (com.hazelcast.executor.impl.DistributedExecutorService)1 FlakeIdGeneratorService (com.hazelcast.flakeidgen.impl.FlakeIdGeneratorService)1 PNCounterService (com.hazelcast.internal.crdt.pncounter.PNCounterService)1 JsonObject (com.hazelcast.internal.json.JsonObject)1 StatisticsAwareService (com.hazelcast.internal.services.StatisticsAwareService)1 MapUtil.createHashMap (com.hazelcast.internal.util.MapUtil.createHashMap)1 JsonSerializable (com.hazelcast.json.internal.JsonSerializable)1 MapService (com.hazelcast.map.impl.MapService)1 MultiMapService (com.hazelcast.multimap.impl.MultiMapService)1