Beispiel #1
0
  /**
   * Provides a cluster specification with default values
   *
   * @param memberCount the total number of members in the cluster to start.
   */
  public static Provider clusterOfSize(int memberCount) {
    Clusters.Cluster cluster = new Clusters.Cluster("neo4j.ha");
    for (int i = 0; i < memberCount; i++) {
      cluster.getMembers().add(new Clusters.Member(5001 + i, true));
    }

    final Clusters clusters = new Clusters();
    clusters.getClusters().add(cluster);
    return provided(clusters);
  }
Beispiel #2
0
  /**
   * Provides a cluster specification with default values
   *
   * @param haMemberCount the total number of members in the cluster to start.
   */
  public static Provider clusterWithAdditionalArbiters(int haMemberCount, int arbiterCount) {
    Clusters.Cluster cluster = new Clusters.Cluster("neo4j.ha");
    int counter = 0;
    for (int i = 0; i < arbiterCount; i++, counter++) {
      cluster.getMembers().add(new Clusters.Member(5001 + counter, false));
    }
    for (int i = 0; i < haMemberCount; i++, counter++) {
      cluster.getMembers().add(new Clusters.Member(5001 + counter, true));
    }

    final Clusters clusters = new Clusters();
    clusters.getClusters().add(cluster);
    return provided(clusters);
  }
Beispiel #3
0
  @Override
  public void start() throws Throwable {
    Clusters clusters = clustersProvider.clusters();

    life = new LifeSupport();

    for (int i = 0; i < clusters.getClusters().size(); i++) {
      Clusters.Cluster cluster = clusters.getClusters().get(i);
      ManagedCluster managedCluster = new ManagedCluster(cluster);
      clusterMap.put(cluster.getName(), managedCluster);
      life.add(managedCluster);
    }

    life.start();
  }
Beispiel #4
0
  @Override
  public void start() throws Throwable {
    Clusters clusters = clustersProvider.clusters();

    life = new LifeSupport();

    // Started so instances added here will be started immediately, and in case of exceptions they
    // can be
    // shutdown() or stop()ped properly
    life.start();

    for (int i = 0; i < clusters.getClusters().size(); i++) {
      Clusters.Cluster cluster = clusters.getClusters().get(i);
      ManagedCluster managedCluster = new ManagedCluster(cluster);
      clusterMap.put(cluster.getName(), managedCluster);
      life.add(managedCluster);
    }
  }