Package org.apache.helix.api.id

Examples of org.apache.helix.api.id.ClusterId


    _connection = new ZkHelixConnection(zkAddress);
    _connection.connect();
  }

  public void stopContainer(String appName, String participantName) throws Exception {
    ClusterId clusterId = ClusterId.from(appName);
    ClusterAccessor clusterAccessor = _connection.createClusterAccessor(clusterId);
    HelixDataAccessor dataAccessor = _connection.createDataAccessor(clusterId);
    ParticipantId participantId = ParticipantId.from(participantName);
    Participant participant = clusterAccessor.readParticipant(participantId);
    if (participant != null && participant.isAlive()) {
View Full Code Here


    String methodName = TestHelper.getTestMethodName();
    String clusterName = className + "_" + methodName;

    System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis()));

    ClusterId clusterId = ClusterId.from(clusterName);
    ControllerId controllerId = ControllerId.from("controller");
    final ParticipantId participantId = ParticipantId.from("participant1");

    ResourceId resourceId = ResourceId.from("testDB");
    State master = State.from("MASTER");
View Full Code Here

    LOG.info("Create a zk-based cluster manager. zkSvr: " + zkAddress + ", clusterName: "
        + clusterName + ", instanceName: " + instanceName + ", type: " + instanceType);

    _zkAddress = zkAddress;
    ClusterId clusterId = ClusterId.from(clusterName);
    if (instanceName == null) {
      try {
        instanceName =
            InetAddress.getLocalHost().getCanonicalHostName() + "-" + instanceType.toString();
      } catch (UnknownHostException e) {
View Full Code Here

    if (cache == null && _cache == null) {
      cache = new ClusterDataCache();
    }
    _cache = cache;

    ClusterId clusterId = ClusterId.from(manager.getClusterName());
    ClusterAccessor clusterAccessor = new ClusterAccessor(clusterId, accessor, _cache);

    Cluster cluster = clusterAccessor.readCluster();

    // Update the cluster status gauges
View Full Code Here

              connection = null;
            }
          }
          if (connection.isConnected()) {
            AppStatusReportGenerator generator = new AppStatusReportGenerator();
            ClusterId clusterId = ClusterId.from(_applicationSpec.getAppName());
            String generateReport = generator.generateReport(connection, clusterId);
            LOG.info(generateReport);
          }
        }
        prevReport = reportMessage;
View Full Code Here

    // connect
    ZkHelixConnection connection = new ZkHelixConnection(zkAddress);
    connection.connect();

    // create the cluster
    ClusterId clusterId = ClusterId.from(clusterName);
    ClusterAccessor clusterAccessor = connection.createClusterAccessor(clusterId);
    StateModelDefinition statelessService =
        new StateModelDefinition(StateModelConfigGenerator.generateConfigForStatelessService());
    StateModelDefinition taskStateModel =
        new StateModelDefinition(StateModelConfigGenerator.generateConfigForTaskStateModel());
View Full Code Here

    // connect
    connection = new ZkHelixConnection(_zkaddr);
    connection.connect();

    // create the cluster
    ClusterId clusterId = ClusterId.from(clusterName);
    ClusterAccessor clusterAccessor = connection.createClusterAccessor(clusterId);
    StateModelDefinition masterSlave =
        new StateModelDefinition(StateModelConfigGenerator.generateConfigForMasterSlave());
    clusterAccessor.createCluster(new ClusterConfig.Builder(clusterId).addStateModelDefinition(
        masterSlave).build());
View Full Code Here

    // set up a participant
    ParticipantConfig participant = getParticipant();

    // cluster id should be unique
    ClusterId clusterId = ClusterId.from("exampleCluster");

    // a user config is an object that stores arbitrary keys and values for a scope
    // in this case, the scope is the cluster with id clusterId
    // this is optional
    UserConfig userConfig = new UserConfig(Scope.cluster(clusterId));
View Full Code Here

    _gZkClient.waitUntilConnected(TIMEOUT, TimeUnit.MILLISECONDS);
    final AtomicBoolean t1Locked = new AtomicBoolean(false);
    final AtomicBoolean t1Done = new AtomicBoolean(false);
    final AtomicInteger field1 = new AtomicInteger(0);
    final AtomicInteger field2 = new AtomicInteger(1);
    final ClusterId clusterId = ClusterId.from("testCluster");
    final HelixLock lock1 = new ZKHelixLock(clusterId, Scope.cluster(clusterId), _gZkClient);
    final HelixLock lock2 = new ZKHelixLock(clusterId, Scope.cluster(clusterId), _gZkClient);

    // thread 1: get a lock, set fields to 1
    Thread t1 = new Thread() {
View Full Code Here

    final String KEY2 = "key2";
    final String VALUE2 = "value2";

    // add the following: key1 straight to user config, key2 to cluster configuration,
    // allow auto join to cluster configuration
    ClusterId clusterId = ClusterId.from("clusterId");
    UserConfig userConfig = new UserConfig(Scope.cluster(clusterId));
    userConfig.setSimpleField(KEY1, VALUE1);
    ClusterConfiguration clusterConfiguration = new ClusterConfiguration(clusterId);
    clusterConfiguration.addNamespacedConfig(userConfig);
    clusterConfiguration.getRecord().setSimpleField(KEY2, VALUE2);
View Full Code Here

TOP

Related Classes of org.apache.helix.api.id.ClusterId

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.