use of com.hazelcast.monitor.LocalWanStats in project hazelcast by hazelcast.
the class MemberStateImpl method fromJson.
//CHECKSTYLE:OFF
@Override
public void fromJson(JsonObject json) {
address = getString(json, "address");
for (JsonObject.Member next : getObject(json, "mapStats")) {
LocalMapStatsImpl stats = new LocalMapStatsImpl();
stats.fromJson(next.getValue().asObject());
mapStats.put(next.getName(), stats);
}
for (JsonObject.Member next : getObject(json, "multiMapStats")) {
LocalMultiMapStatsImpl stats = new LocalMultiMapStatsImpl();
stats.fromJson(next.getValue().asObject());
multiMapStats.put(next.getName(), stats);
}
for (JsonObject.Member next : getObject(json, "replicatedMapStats", new JsonObject())) {
LocalReplicatedMapStats stats = new LocalReplicatedMapStatsImpl();
stats.fromJson(next.getValue().asObject());
replicatedMapStats.put(next.getName(), stats);
}
for (JsonObject.Member next : getObject(json, "queueStats")) {
LocalQueueStatsImpl stats = new LocalQueueStatsImpl();
stats.fromJson(next.getValue().asObject());
queueStats.put(next.getName(), stats);
}
for (JsonObject.Member next : getObject(json, "topicStats")) {
LocalTopicStatsImpl stats = new LocalTopicStatsImpl();
stats.fromJson(next.getValue().asObject());
topicStats.put(next.getName(), stats);
}
for (JsonObject.Member next : getObject(json, "executorStats")) {
LocalExecutorStatsImpl stats = new LocalExecutorStatsImpl();
stats.fromJson(next.getValue().asObject());
executorStats.put(next.getName(), stats);
}
for (JsonObject.Member next : getObject(json, "cacheStats", new JsonObject())) {
LocalCacheStats stats = new LocalCacheStatsImpl();
stats.fromJson(next.getValue().asObject());
cacheStats.put(next.getName(), stats);
}
for (JsonObject.Member next : getObject(json, "wanStats", new JsonObject())) {
LocalWanStats stats = new LocalWanStatsImpl();
stats.fromJson(next.getValue().asObject());
wanStats.put(next.getName(), stats);
}
for (JsonObject.Member next : getObject(json, "runtimeProps")) {
runtimeProps.put(next.getName(), next.getValue().asLong());
}
final JsonArray jsonClients = getArray(json, "clients");
for (JsonValue jsonClient : jsonClients) {
final ClientEndPointDTO client = new ClientEndPointDTO();
client.fromJson(jsonClient.asObject());
clients.add(client);
}
beans = new MXBeansDTO();
beans.fromJson(getObject(json, "beans"));
JsonObject jsonMemoryStats = getObject(json, "memoryStats", null);
if (jsonMemoryStats != null) {
memoryStats.fromJson(jsonMemoryStats);
}
JsonObject jsonOperationStats = getObject(json, "operationStats", null);
if (jsonOperationStats != null) {
operationStats.fromJson(jsonOperationStats);
}
JsonObject jsonMemberPartitionState = getObject(json, "memberPartitionState", null);
if (jsonMemberPartitionState != null) {
memberPartitionState = new MemberPartitionStateImpl();
memberPartitionState.fromJson(jsonMemberPartitionState);
}
JsonObject jsonNodeState = getObject(json, "nodeState", null);
if (jsonNodeState != null) {
nodeState = new NodeStateImpl();
nodeState.fromJson(jsonNodeState);
}
JsonObject jsonHotRestartState = getObject(json, "hotRestartState", null);
if (jsonHotRestartState != null) {
hotRestartState = new HotRestartStateImpl();
hotRestartState.fromJson(jsonHotRestartState);
}
JsonObject jsonClusterHotRestartStatus = getObject(json, "clusterHotRestartStatus", null);
if (jsonClusterHotRestartStatus != null) {
clusterHotRestartStatus = new ClusterHotRestartStatusDTO();
clusterHotRestartStatus.fromJson(jsonClusterHotRestartStatus);
}
JsonObject jsonWanSyncState = getObject(json, "wanSyncState", null);
if (jsonWanSyncState != null) {
wanSyncState = new WanSyncStateImpl();
wanSyncState.fromJson(jsonWanSyncState);
}
}
use of com.hazelcast.monitor.LocalWanStats 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);
}
use of com.hazelcast.monitor.LocalWanStats in project hazelcast by hazelcast.
the class TimedMemberStateFactory method handleWan.
private int handleWan(MemberStateImpl memberState, int count, Map<String, LocalWanStats> wans, Set<String> longInstanceNames) {
for (Map.Entry<String, LocalWanStats> entry : wans.entrySet()) {
String schemeName = entry.getKey();
LocalWanStats stats = entry.getValue();
memberState.putLocalWanStats(schemeName, stats);
longInstanceNames.add("w:" + schemeName);
count++;
}
return count;
}
use of com.hazelcast.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);
LocalWanPublisherStatsImpl singapore = new LocalWanPublisherStatsImpl();
singapore.setConnected(true);
singapore.setOutboundQueueSize(200);
singapore.incrementPublishedEventCount(20);
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();
deserialized.fromJson(serialized);
LocalWanPublisherStats deserializedTokyo = deserialized.getLocalWanPublisherStats().get("tokyo");
LocalWanPublisherStats deserializedSingapore = deserialized.getLocalWanPublisherStats().get("singapore");
assertEquals(tokyo.isConnected(), deserializedTokyo.isConnected());
assertEquals(tokyo.getTotalPublishedEventCount(), deserializedTokyo.getTotalPublishedEventCount());
assertEquals(tokyo.getOutboundQueueSize(), deserializedTokyo.getOutboundQueueSize());
assertEquals(tokyo.getTotalPublishLatency(), deserializedTokyo.getTotalPublishLatency());
assertEquals(singapore.isConnected(), deserializedSingapore.isConnected());
assertEquals(singapore.getTotalPublishedEventCount(), deserializedSingapore.getTotalPublishedEventCount());
assertEquals(singapore.getOutboundQueueSize(), deserializedSingapore.getOutboundQueueSize());
assertEquals(singapore.getTotalPublishLatency(), deserializedSingapore.getTotalPublishLatency());
}
Aggregations