Exemple #1
0
  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();
  }
 public String role() {
   return members.getSelf().getHARole();
 }