use of com.hazelcast.internal.json.JsonArray in project hazelcast by hazelcast.
the class ClusterHotRestartStatusDTO method fromJson.
@Override
public void fromJson(JsonObject root) {
String dataRecoveryPolicyStr = root.getString("dataRecoveryPolicy", FULL_RECOVERY_ONLY.toString());
dataRecoveryPolicy = HotRestartClusterDataRecoveryPolicy.valueOf(dataRecoveryPolicyStr);
String hotRestartStatusStr = root.getString("hotRestartStatus", ClusterHotRestartStatus.UNKNOWN.toString());
hotRestartStatus = ClusterHotRestartStatus.valueOf(hotRestartStatusStr);
remainingValidationTimeMillis = root.getLong("remainingValidationTimeMillis", -1);
remainingDataLoadTimeMillis = root.getLong("remainingDataLoadTimeMillis", -1);
JsonArray memberStatuses = (JsonArray) root.get("memberHotRestartStatuses");
memberHotRestartStatusMap = createHashMap(memberStatuses.size());
for (JsonValue value : memberStatuses) {
JsonObject memberStatus = (JsonObject) value;
String member = memberStatus.getString("member", "<unknown>");
MemberHotRestartStatus status = MemberHotRestartStatus.valueOf(memberStatus.getString("status", MemberHotRestartStatus.PENDING.toString()));
memberHotRestartStatusMap.put(member, status);
}
}
use of com.hazelcast.internal.json.JsonArray in project hazelcast by hazelcast.
the class ClusterHotRestartStatusDTO method toJson.
@Override
public JsonObject toJson() {
JsonObject root = new JsonObject();
root.add("dataRecoveryPolicy", dataRecoveryPolicy.toString());
root.add("hotRestartStatus", hotRestartStatus.toString());
root.add("remainingValidationTimeMillis", remainingValidationTimeMillis);
root.add("remainingDataLoadTimeMillis", remainingDataLoadTimeMillis);
JsonArray memberStatuses = new JsonArray();
for (Map.Entry<String, MemberHotRestartStatus> entry : memberHotRestartStatusMap.entrySet()) {
String member = entry.getKey();
MemberHotRestartStatus status = entry.getValue();
JsonObject pair = new JsonObject();
pair.add("member", member);
pair.add("status", status.toString());
memberStatuses.add(pair);
}
root.add("memberHotRestartStatuses", memberStatuses);
return root;
}
use of com.hazelcast.internal.json.JsonArray in project hazelcast by hazelcast.
the class DiscoveryConfigDTO method toJson.
@Override
public JsonObject toJson() {
JsonObject root = new JsonObject().add("nodeFilterClass", config.getNodeFilterClass());
JsonArray strategies = new JsonArray();
for (DiscoveryStrategyConfig strategyConfig : config.getDiscoveryStrategyConfigs()) {
DiscoveryStrategyConfigDTO dto = new DiscoveryStrategyConfigDTO(strategyConfig);
strategies.add(dto.toJson());
}
root.add("discoveryStrategy", strategies);
return root;
}
use of com.hazelcast.internal.json.JsonArray in project hazelcast by hazelcast.
the class WanConfigurationExtendedEvent method toJson.
@Override
public JsonObject toJson() {
JsonObject json = super.toJson();
JsonArray publisherIds = new JsonArray();
for (String publisherId : wanPublisherIds) {
publisherIds.add(publisherId);
}
json.add("wanPublisherIds", publisherIds);
return json;
}
use of com.hazelcast.internal.json.JsonArray in project hazelcast by hazelcast.
the class MemberStateImpl method toJson.
@Override
public JsonObject toJson() {
final JsonObject root = new JsonObject();
root.add("address", address);
String uuidString = uuid != null ? uuid.toString() : null;
root.add("uuid", uuidString);
String cpMemberUuidString = cpMemberUuid != null ? cpMemberUuid.toString() : null;
root.add("cpMemberUuid", cpMemberUuidString);
root.add("name", name);
final JsonArray endpoints = new JsonArray();
for (Entry<EndpointQualifier, Address> entry : this.endpoints.entrySet()) {
JsonObject address = new JsonObject();
address.set("host", entry.getValue().getHost());
address.set("port", entry.getValue().getPort());
JsonObject endpoint = new JsonObject();
endpoint.set("protocol", entry.getKey().getType().name());
endpoint.set("address", address);
if (entry.getKey().getIdentifier() != null) {
endpoint.set("id", entry.getKey().getIdentifier());
}
endpoints.add(endpoint);
}
root.add("endpoints", endpoints);
serializeAsMap(root, "mapStats", mapsWithStats);
serializeAsMap(root, "multiMapStats", multiMapsWithStats);
serializeAsMap(root, "replicatedMapStats", replicatedMapsWithStats);
serializeAsMap(root, "queueStats", queuesWithStats);
serializeAsMap(root, "topicStats", topicsWithStats);
serializeAsMap(root, "reliableTopicStats", reliableTopicsWithStats);
serializeAsMap(root, "pnCounterStats", pnCountersWithStats);
serializeAsMap(root, "executorStats", executorsWithStats);
serializeAsMap(root, "scheduledExecutorStats", scheduledExecutorsWithStats);
serializeAsMap(root, "durableExecutorStats", durableExecutorsWithStats);
serializeAsMap(root, "cacheStats", cachesWithStats);
serializeAsMap(root, "flakeIdStats", flakeIdGeneratorsWithStats);
serializeMap(root, "wanStats", wanStats);
final JsonArray clientsArray = new JsonArray();
for (ClientEndPointDTO client : clients) {
clientsArray.add(client.toJson());
}
root.add("clients", clientsArray);
addJsonIfSerializable(root, "operationStats", operationStats);
root.add("memberPartitionState", memberPartitionState.toJson());
root.add("nodeState", nodeState.toJson());
root.add("hotRestartState", hotRestartState.toJson());
root.add("clusterHotRestartStatus", clusterHotRestartStatus.toJson());
JsonObject clientStatsObject = new JsonObject();
for (Map.Entry<UUID, String> entry : clientStats.entrySet()) {
clientStatsObject.add(entry.getKey().toString(), entry.getValue());
}
root.add("clientStats", clientStatsObject);
return root;
}
Aggregations