This commit is contained in:
Redkale
2020-07-30 09:44:07 +08:00
parent e62d9f8201
commit 84147280cf
2 changed files with 8 additions and 7 deletions

View File

@@ -1149,6 +1149,13 @@ public final class Application {
}
logger.info("MessageAgent(names=" + JsonConvert.root().convertTo(names) + ") stop in " + (System.currentTimeMillis() - s) + " ms");
}
if (clusterAgent != null) {
if (logger.isLoggable(Level.FINER)) logger.log(Level.FINER, "ClusterAgent destroying");
long s = System.currentTimeMillis();
clusterAgent.deregister(this);
clusterAgent.destroy(clusterAgent.getConfig());
logger.info("ClusterAgent destroy in " + (System.currentTimeMillis() - s) + " ms");
}
localServers.stream().forEach((server) -> {
try {
server.shutdown();
@@ -1158,13 +1165,6 @@ public final class Application {
serversLatch.countDown();
}
});
if (clusterAgent != null) {
if (logger.isLoggable(Level.FINER)) logger.log(Level.FINER, "ClusterAgent destroying");
long s = System.currentTimeMillis();
clusterAgent.deregister(this);
clusterAgent.destroy(clusterAgent.getConfig());
logger.info("ClusterAgent destroy in " + (System.currentTimeMillis() - s) + " ms");
}
if (this.messageAgents != null) {
Set<String> names = new HashSet<>();
if (logger.isLoggable(Level.FINER)) logger.log(Level.FINER, "MessageAgent destroying");

View File

@@ -49,6 +49,7 @@ public interface Service {
/**
* 进程退出时调用Service销毁
* 远程模式下该方法会重载成空方法
* 注意: 在此方法内不能调用MessageClient.sendMessage 方法因为Application关闭时会先destroy掉MessageClient
*
* @param config 配置参数
*/