Hi,

I am a new user of Apache Helix, I started prototyping and so far I'm excited about it :).

I have a question related to stopping participants and controllers.

The demo code is the following :

HelixManager manager = HelixManagerFactory.getZKHelixManager(CLUSTER_NAME, "localhost_7000", InstanceType.PARTICIPANT, ZK_ADDRESS);
try {
  StateMachineEngine stateMach = manager.getStateMachineEngine();
  MasterSlaveStateModelFactory stateModelFactory = new MasterSlaveStateModelFactory();
   stateMach.registerStateModelFactory(STATE_MODEL_NAME, stateModelFactory);
   manager.connect();
   System.in.read(); // wait for user input before stopping the participant
} catch (Exception e) {
   e.printStackTrace();
} finally {
  manager.disconnect();
}

My problem is the program is hanging after manager.disconnect() because some threads are still alive. They are created here:

1 - First one is created in the constructor of ZKHelixManager that is calling HelixPropertyFactory.getInstance().getHelixManagerProperty(zkAddress, clusterName)), that is creating a ConfigAccessor object that is creating a ZkClient (I don't know how to close it).

2 - Second one is the static SubscribeChangeEventProcessor thread of the org.apache.helix.manager.zk.CallbackHandler class.

Could you tell me if I forgot something in my program?
I guess I can try to call setDaemon(true) on SubscribeChangeEventProcessor, but I don't know how I can close the ZkClient.

Thank you!

Bruno.

Reply via email to