This commit is contained in:
Redkale
2020-06-05 13:50:58 +08:00
parent 6a5d121615
commit a477b2fb73
2 changed files with 6 additions and 7 deletions

View File

@@ -1036,7 +1036,6 @@ public final class Application {
}
});
if (clusterAgent != null) {
clusterAgent.stop();
clusterAgent.destroy(clusterAgent.getConfig());
}
if (this.messageAgents != null) {

View File

@@ -103,12 +103,12 @@ public abstract class ClusterAgent {
//注销服务
public void deregister(NodeServer ns, String protocol, Set<Service> localServices, Set<Service> remoteServices) {
//注销本地模式
//注销本地模式 远程模式不注册
for (Service service : localServices) {
if (!canRegister(protocol, service)) continue;
deregister(ns, protocol, service);
}
//远程模式不注册
afterDeregister(ns, protocol);
}
protected boolean canRegister(String protocol, Service service) {
@@ -122,14 +122,14 @@ public abstract class ClusterAgent {
public void start() {
}
public void stop() {
protected void afterDeregister(NodeServer ns, String protocol) {
int s = intervalCheckSeconds();
if (s > 0) { //暂停,弥补其他依赖本进程服务的周期偏差
if (s / 2 > 0) { //暂停,弥补其他依赖本进程服务的周期偏差
try {
Thread.sleep(s * 1000);
Thread.sleep(s * 1000 / 2);
} catch (InterruptedException ex) {
}
logger.info(this.getClass().getSimpleName() + " sleep " + s + "s after deregister");
logger.info(this.getClass().getSimpleName() + " sleep " + s / 2 + "s after deregister");
}
}