bfreuden opened a new issue #1518:
URL: https://github.com/apache/helix/issues/1518
### Describe the bug
When you create a ``HelixManager`` then disconnect it with
``manager.disconnect();`` the JVM cannot naturally exit because the
`` org.apache.helix.manager.zk.CallbackHandler`` has a private static field
called ``SubscribeChangeEventProcessor`` that is a running Thread.
### To Reproduce
Granted the following program is not very useful (starting and stopping a
participant) but it cannot exit naturally:
```java
public static void main(String[] args) {
HelixManager manager = HelixManagerFactory.getZKHelixManager(
CLUSTER_NAME, "localhost_7000", InstanceType.PARTICIPANT,
ZK_ADDRESS);
try {
StateMachineEngine stateMach = manager.getStateMachineEngine();
StateModelFactory stateModelFactory = getStateModelFactory();
stateMach.registerStateModelFactory(STATE_MODEL_NAME,
stateModelFactory);
manager.connect();
Runtime.getRuntime().addShutdownHook(new
HelixManagerShutdownHook(manager));
} catch (Exception e) {
e.printStackTrace();
} finally {
manager.disconnect();
}
}
```
### Expected behavior
I was expecting a programmatic way to terminate all Helix threads.
For the moment I have this solution:
```java
} finally {
manager.disconnect();
try {
Field field =
CallbackHandler.class.getDeclaredField("SubscribeChangeEventProcessor");
field.setAccessible(true);
Thread thread = (Thread)field.get(null);
thread.interrupt();
} catch (NoSuchFieldException | IllegalAccessException e) {
e.printStackTrace();
}
}
```
### Possible solution
I have the impression that if the ``SubscribeChangeEventProcessor`` Thread
was a daemon thread, it would be enough.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]