This commit is contained in:
redkale
2023-10-07 22:53:04 +08:00
parent 341309e7ae
commit 26795ece3f
3 changed files with 12 additions and 8 deletions

View File

@@ -363,8 +363,12 @@ public abstract class NodeServer {
final boolean ws = (srcObj instanceof org.redkale.net.http.WebSocketNodeService);
CacheSource source = application.loadCacheSource(resourceName, ws);
field.set(srcObj, source);
logger.info("Load CacheSource (type = " + (source == null ? null : source.getClass().getSimpleName()) + ", resourceName = '" + resourceName + "')");
Resource res = field.getAnnotation(Resource.class);
if (res != null && res.required() && source == null) {
throw new RedkaleException("CacheSource (resourceName = '" + resourceName + "') not found");
} else {
logger.info("Load CacheSource (type = " + (source == null ? null : source.getClass().getSimpleName()) + ", resourceName = '" + resourceName + "')");
}
return source;
} catch (Exception e) {
logger.log(Level.SEVERE, "DataSource inject error", e);

View File

@@ -175,17 +175,17 @@ public abstract class MessageAgent implements Resourcable {
this.httpMessageClient.close();
this.sncpMessageClient.close();
if (this.sncpClientProducer != null) {
this.sncpClientProducer.stop();
}
if (this.httpClientProducer != null) {
this.httpClientProducer.stop();
}
if (this.sncpClientProducer != null) {
this.sncpClientProducer.stop();
}
if (this.clientMessageCoder instanceof Service) {
((Service) this.clientMessageCoder).destroy(config);
}
if (this.timeoutExecutor != null) {
this.timeoutExecutor.shutdownNow();
this.timeoutExecutor.shutdown();
}
if (this.workExecutor != null && this.workExecutor != application.getWorkExecutor()) {
this.workExecutor.shutdownNow();

View File

@@ -11,8 +11,8 @@ import java.util.*;
import java.util.concurrent.*;
import java.util.logging.*;
import java.util.stream.*;
import org.redkale.annotation.Comment;
import org.redkale.annotation.*;
import org.redkale.annotation.Comment;
import org.redkale.boot.Application;
import org.redkale.convert.*;
import org.redkale.convert.json.JsonConvert;
@@ -38,7 +38,7 @@ public abstract class WebSocketNode implements Service {
@Comment("存储当前SNCP节点列表的key")
public static final String WS_SOURCE_KEY_NODES = "sncpws_nodes";
protected final Logger logger = Logger.getLogger(this.getClass().getSimpleName());
protected final Logger logger = Logger.getLogger(WebSocketNode.class.getSimpleName());
//"SNCP_ADDR" 如果不是分布式(没有SNCP) 值为null
@Resource(name = Application.RESNAME_SNCP_ADDRESS, required = false)