[
https://issues.apache.org/jira/browse/TWILL-133?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14584451#comment-14584451
]
ASF GitHub Bot commented on TWILL-133:
--------------------------------------
Github user hsaputra commented on a diff in the pull request:
https://github.com/apache/incubator-twill/pull/41#discussion_r32368035
--- Diff:
twill-zookeeper/src/main/java/org/apache/twill/internal/zookeeper/DefaultZKClientService.java
---
@@ -420,23 +444,18 @@ protected void terminated() {
@Override
protected void doStop() {
- ZooKeeper zk = zooKeeper.getAndSet(null);
- if (zk != null) {
- try {
- zk.close();
- } catch (InterruptedException e) {
- notifyFailed(e);
- } finally {
- eventExecutor.shutdown();
- executorStopped = true;
-
- // If the executor state is terminated, meaning the terminate()
method is triggered,
- // call notifyStopped() if it hasn't been called yet.
- if (eventExecutor.isTerminated() &&
stopNotified.compareAndSet(false, true)) {
+ eventExecutor.submit(new Runnable() {
--- End diff --
Why we need to run stop on separate thread?
> ZookeeperClientService may hang at startup and then cannot be stopped
> ---------------------------------------------------------------------
>
> Key: TWILL-133
> URL: https://issues.apache.org/jira/browse/TWILL-133
> Project: Apache Twill
> Issue Type: Bug
> Reporter: Andreas Neumann
>
> If the Zookeeper quorum is configured incorrectly, then the ZK client service
> will wait for ZK to come up, and it won't start until it can connect to ZK.
> While it is in this state, it can now not be stopped, because stop() will
> wait for the state to become RUNNING before it does anything.
> There should be a way to stop a service that hangs at startup.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)