This commit is contained in:
Redkale
2020-06-04 09:44:00 +08:00
parent 1d7a72f992
commit 59d139ace2
2 changed files with 9 additions and 0 deletions

View File

@@ -1016,6 +1016,13 @@ public final class Application {
if (clusterAgent != null) {
clusterAgent.destroy(clusterAgent.getConfig());
}
if (this.messageAgents != null) {
long s = System.currentTimeMillis();
for (MessageAgent agent : this.messageAgents) {
agent.destroy(agent.getConfig());
}
logger.info(this.getClass().getSimpleName() + " MessageAgent destroy in " + (System.currentTimeMillis() - s) + " ms\r\n");
}
for (DataSource source : dataSources) {
if (source == null) continue;
try {

View File

@@ -91,6 +91,8 @@ public abstract class MessageAgent {
}
public void destroy(AnyValue config) {
if (this.sncpRespConsumer != null) this.sncpRespConsumer.shutdown().join();
if (this.producer != null) this.producer.shutdown().join();
}
public String getName() {