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);
}
}
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());
}
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));
}
}
}
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();
}
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);
}
}
Aggregations