This commit is contained in:
redkale
2023-10-07 23:42:52 +08:00
parent fc574a31ff
commit 33e751a44c
3 changed files with 16 additions and 3 deletions

View File

@@ -870,11 +870,11 @@ public abstract class NodeServer {
localServices.forEach(y -> {
long s = System.currentTimeMillis();
if (finest) {
logger.finest(y + " is destroying");
logger.finest(Sncp.getResourceType(y) + " is destroying");
}
y.destroy(Sncp.getResourceConf(y));
if (finest) {
logger.finest(y + " was destroyed");
logger.finest(Sncp.getResourceType(y) + " was destroyed");
}
long e = System.currentTimeMillis() - s;
if (e > 2 && sb != null) {

View File

@@ -167,28 +167,40 @@ public abstract class MessageAgent implements Resourcable {
//Application.stop 在所有server.shutdown执行后执行
public void destroy(AnyValue config) {
logger.log(Level.FINE, "MessageConsumer destroying");
for (MessageConsumer consumer : messageConsumerList) {
consumer.destroy(config);
}
this.messageConsumerList.clear();
this.messageConsumerMap.clear();
logger.log(Level.FINE, "MessageConsumer destroyed");
this.httpMessageClient.close();
this.sncpMessageClient.close();
logger.log(Level.FINE, "httpMessageClient and sncpMessageClient destroyed");
if (this.httpClientProducer != null) {
logger.log(Level.FINE, "httpClientProducer stoping");
this.httpClientProducer.stop();
logger.log(Level.FINE, "httpClientProducer stoped");
}
if (this.sncpClientProducer != null) {
logger.log(Level.FINE, "sncpClientProducer stoping");
this.sncpClientProducer.stop();
logger.log(Level.FINE, "sncpClientProducer stoped");
}
if (this.clientMessageCoder instanceof Service) {
logger.log(Level.FINE, "clientMessageCoder destroying");
((Service) this.clientMessageCoder).destroy(config);
logger.log(Level.FINE, "clientMessageCoder destroyed");
}
if (this.timeoutExecutor != null) {
this.timeoutExecutor.shutdown();
this.timeoutExecutor.shutdownNow();
logger.log(Level.FINE, "timeoutExecutor shutdownNow");
}
if (this.workExecutor != null && this.workExecutor != application.getWorkExecutor()) {
this.workExecutor.shutdownNow();
logger.log(Level.FINE, "workExecutor shutdownNow");
}
}

View File

@@ -251,6 +251,7 @@ public abstract class Sncp {
public static <T extends Service> Class getServiceType(Class<T> serviceImplClass) {
SncpDyn dyn = serviceImplClass.getAnnotation(SncpDyn.class);
System.out.println("dyn = " + dyn + ", serviceImplClass = " + serviceImplClass + ", type = " + (dyn == null ? "ddd" : dyn.type()));
return dyn != null ? dyn.type() : serviceImplClass;
}