public static String stateToString(ManagedCluster cluster) { StringBuilder buf = new StringBuilder("\n"); for (HighlyAvailableGraphDatabase database : cluster.getAllMembers()) { ClusterClient client = database.getDependencyResolver().resolveDependency(ClusterClient.class); buf.append("Instance ") .append(client.getServerId()) .append(":State ") .append(database.getInstanceState()) .append(" (") .append(client.getClusterServer()) .append("):") .append("\n"); ClusterMembers members = database.getDependencyResolver().resolveDependency(ClusterMembers.class); for (ClusterMember clusterMember : members.getMembers()) { buf.append(" ") .append(clusterMember.getInstanceId()) .append(":") .append(clusterMember.getHARole()) .append(" (is alive = ") .append(clusterMember.isAlive()) .append(")") .append("\n"); } } return buf.toString(); }
@Override public void repair() throws Throwable { cluster.startMember(serverId); }
@Override public HighlyAvailableGraphDatabase repair() throws Throwable { cluster.startMember(serverId); return cluster.getMemberByServerId(serverId); }