All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.qwazr.cluster.service.ClusterStatusJson Maven / Gradle / Ivy

There is a newer version: 1.5.2
Show newest version
/**
 * Copyright 2015-2016 Emmanuel Keller / QWAZR
 * 

* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at *

* http://www.apache.org/licenses/LICENSE-2.0 *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.qwazr.cluster.service; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.qwazr.cluster.service.ClusterServiceStatusJson.StatusEnum; import com.qwazr.utils.server.ServerException; import java.util.Date; import java.util.Set; import java.util.TreeMap; import java.util.TreeSet; @JsonInclude(Include.NON_NULL) public class ClusterStatusJson { public final String me; public final String webapp; public final TreeMap> groups; public final TreeMap services; public final Date last_keep_alive_execution; public final TreeMap active_nodes; public final TreeSet masters; public ClusterStatusJson() { me = null; webapp = null; groups = null; services = null; last_keep_alive_execution = null; active_nodes = null; masters = null; } public ClusterStatusJson(final String me, final String webapp, final TreeMap nodesMap, final TreeMap> groups, final TreeMap> services, final Set masters, final Date lastKeepAliveExecution) throws ServerException { this.me = me; this.webapp = webapp; this.groups = groups; this.services = new TreeMap<>(); if (services != null) { services.forEach((service, nodesSet) -> this.services .put(service, ClusterServiceStatusJson.findStatus(nodesSet.size()))); } this.masters = masters == null || masters.isEmpty() ? null : new TreeSet<>(masters); this.last_keep_alive_execution = lastKeepAliveExecution; this.active_nodes = nodesMap; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy