void callShutDown() {
   for (PersistenceManagerFactory factory : persistenceManagerFactories) {
     log.info("Call shutdown on " + factory);
     factory.shutDown();
   }
   for (Cluster cluster : clusters) {
     log.info(
         String.format(
             "Call shutdown on Cluster instance '%s' of cluster name '%s'",
             cluster, cluster.getClusterName()));
     cluster.closeAsync().force();
   }
 }
Example #2
0
  public static String[] getHosts(Cluster cluster) {

    if (cluster == null) {
      System.out.println("Creating cluster connection");
      cluster = Cluster.builder().addContactPoint(Host).build();
    }
    System.out.println("Cluster Name " + cluster.getClusterName());
    Metadata mdata = cluster.getMetadata();
    Set<Host> hosts = mdata.getAllHosts();
    String sHosts[] = new String[hosts.size()];

    Iterator<Host> it = hosts.iterator();
    int i = 0;
    while (it.hasNext()) {
      Host ch = it.next();
      sHosts[i] = (String) ch.getAddress().toString();

      System.out.println("Hosts" + ch.getAddress().toString());
      i++;
    }

    return sHosts;
  }