未验证 提交 839d6054 编写于 作者: W Wenjun Ruan 提交者: GitHub

fix dead server cannot stop (#6046)

上级 04720b32
......@@ -47,6 +47,7 @@ import org.apache.curator.framework.recipes.locks.InterProcessMutex;
import org.apache.curator.retry.ExponentialBackoffRetry;
import org.apache.curator.utils.CloseableUtils;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.ZooDefs;
import org.apache.zookeeper.data.ACL;
......@@ -195,12 +196,7 @@ public class ZookeeperRegistry implements Registry {
@Override
public void remove(String key) {
try {
client.delete().deletingChildrenIfNeeded().forPath(key);
} catch (Exception e) {
throw new RegistryException("zookeeper remove error", e);
}
delete(key);
}
@Override
......@@ -269,6 +265,9 @@ public class ZookeeperRegistry implements Registry {
client.delete()
.deletingChildrenIfNeeded()
.forPath(nodePath);
} catch (KeeperException.NoNodeException ignore) {
// the node is not exist, we can believe the node has been removed
} catch (Exception e) {
throw new RegistryException("zookeeper delete key error", e);
}
......
......@@ -181,6 +181,7 @@ public class WorkerServer implements IStoppable {
this.nettyRemotingServer.close();
this.workerRegistryClient.unRegistry();
this.alertClientService.close();
this.springApplicationContext.close();
} catch (Exception e) {
logger.error("worker server stop exception ", e);
}
......
......@@ -49,6 +49,7 @@ public class RetryReportTaskStatusThread implements Runnable {
public void start(){
Thread thread = new Thread(this,"RetryReportTaskStatusThread");
thread.setDaemon(true);
thread.start();
}
......
......@@ -123,6 +123,7 @@ public class WorkerManagerThread implements Runnable {
public void start() {
Thread thread = new Thread(this, this.getClass().getName());
thread.setDaemon(true);
thread.start();
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册