优化
This commit is contained in:
@@ -363,8 +363,12 @@ public abstract class NodeServer {
|
|||||||
final boolean ws = (srcObj instanceof org.redkale.net.http.WebSocketNodeService);
|
final boolean ws = (srcObj instanceof org.redkale.net.http.WebSocketNodeService);
|
||||||
CacheSource source = application.loadCacheSource(resourceName, ws);
|
CacheSource source = application.loadCacheSource(resourceName, ws);
|
||||||
field.set(srcObj, source);
|
field.set(srcObj, source);
|
||||||
|
Resource res = field.getAnnotation(Resource.class);
|
||||||
logger.info("Load CacheSource (type = " + (source == null ? null : source.getClass().getSimpleName()) + ", resourceName = '" + resourceName + "')");
|
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;
|
return source;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.log(Level.SEVERE, "DataSource inject error", e);
|
logger.log(Level.SEVERE, "DataSource inject error", e);
|
||||||
|
|||||||
@@ -175,17 +175,17 @@ public abstract class MessageAgent implements Resourcable {
|
|||||||
|
|
||||||
this.httpMessageClient.close();
|
this.httpMessageClient.close();
|
||||||
this.sncpMessageClient.close();
|
this.sncpMessageClient.close();
|
||||||
if (this.sncpClientProducer != null) {
|
|
||||||
this.sncpClientProducer.stop();
|
|
||||||
}
|
|
||||||
if (this.httpClientProducer != null) {
|
if (this.httpClientProducer != null) {
|
||||||
this.httpClientProducer.stop();
|
this.httpClientProducer.stop();
|
||||||
}
|
}
|
||||||
|
if (this.sncpClientProducer != null) {
|
||||||
|
this.sncpClientProducer.stop();
|
||||||
|
}
|
||||||
if (this.clientMessageCoder instanceof Service) {
|
if (this.clientMessageCoder instanceof Service) {
|
||||||
((Service) this.clientMessageCoder).destroy(config);
|
((Service) this.clientMessageCoder).destroy(config);
|
||||||
}
|
}
|
||||||
if (this.timeoutExecutor != null) {
|
if (this.timeoutExecutor != null) {
|
||||||
this.timeoutExecutor.shutdownNow();
|
this.timeoutExecutor.shutdown();
|
||||||
}
|
}
|
||||||
if (this.workExecutor != null && this.workExecutor != application.getWorkExecutor()) {
|
if (this.workExecutor != null && this.workExecutor != application.getWorkExecutor()) {
|
||||||
this.workExecutor.shutdownNow();
|
this.workExecutor.shutdownNow();
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ import java.util.*;
|
|||||||
import java.util.concurrent.*;
|
import java.util.concurrent.*;
|
||||||
import java.util.logging.*;
|
import java.util.logging.*;
|
||||||
import java.util.stream.*;
|
import java.util.stream.*;
|
||||||
import org.redkale.annotation.Comment;
|
|
||||||
import org.redkale.annotation.*;
|
import org.redkale.annotation.*;
|
||||||
|
import org.redkale.annotation.Comment;
|
||||||
import org.redkale.boot.Application;
|
import org.redkale.boot.Application;
|
||||||
import org.redkale.convert.*;
|
import org.redkale.convert.*;
|
||||||
import org.redkale.convert.json.JsonConvert;
|
import org.redkale.convert.json.JsonConvert;
|
||||||
@@ -38,7 +38,7 @@ public abstract class WebSocketNode implements Service {
|
|||||||
@Comment("存储当前SNCP节点列表的key")
|
@Comment("存储当前SNCP节点列表的key")
|
||||||
public static final String WS_SOURCE_KEY_NODES = "sncpws_nodes";
|
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
|
//"SNCP_ADDR" 如果不是分布式(没有SNCP) 值为null
|
||||||
@Resource(name = Application.RESNAME_SNCP_ADDRESS, required = false)
|
@Resource(name = Application.RESNAME_SNCP_ADDRESS, required = false)
|
||||||
|
|||||||
Reference in New Issue
Block a user