Hey Guys,

We have used the "Distributed lock manager" sample as our resource for
building Leader election mechanism.

We have one partition, each JVM (participant) is Leader or Standby, that
is, one JVM do the job.

In above usage we didn't implement InstanceConfig object but just
ParticipantManager for each participant process, that is, the following
start method of LockProcess missing the configureInstance(String
instanceName) method.

  public void start() throws Exception
  {
    System.out.println("STARTING "+ instanceName +"\n");
    configureInstance(instanceName);

    participantManager = HelixManagerFactory.getZKHelixManager(clusterName,
instanceName, InstanceType.PARTICIPANT, zkAddress);

participantManager.getStateMachineEngine().registerStateModelFactory("LeaderStandby",
new LockFactory());
    participantManager.connect();

    if (startController)
    {
      startController();
    }
    System.out.println("STARTED "+ instanceName+"\n");

  }


  private void configureInstance(String instanceName)
  {
    ZKHelixAdmin helixAdmin = new ZKHelixAdmin(zkAddress);

    List<String> instancesInCluster = helixAdmin
        .getInstancesInCluster(clusterName);
    if (instancesInCluster == null ||
!instancesInCluster.contains(instanceName))
    {
      InstanceConfig config = new InstanceConfig(instanceName);
      config.setHostName("localhost");
      config.setPort("12000");
      helixAdmin.addInstance(clusterName, config);
    }
  }

How above implementation without the InstanceConfig can effect, what we
lose if we don't use InstanceConfig and whether it can works at all?

Thanks in advance,
Erwin Karbasi
AT&T, Senior Software Architect

Reply via email to