This commit is contained in:
redkale
2023-06-29 19:31:38 +08:00
parent 4a62ea0cd3
commit 2fa3b1c7b2
2 changed files with 11 additions and 13 deletions

View File

@@ -502,14 +502,9 @@ public final class Application {
Set<String> mqnames = new HashSet<>(); Set<String> mqnames = new HashSet<>();
for (int i = 0; i < mqConfs.length; i++) { for (int i = 0; i < mqConfs.length; i++) {
AnyValue mqConf = mqConfs[i]; AnyValue mqConf = mqConfs[i];
String mqname = mqConf.getValue("name", ""); String names = mqConf.getValue("name"); //含,或者;表示多个别名使用同一mq对象
if (mqnames.contains(mqname)) { if (names != null && !names.isEmpty()) {
throw new RedkaleException("mq.name(" + mqname + ") is repeat"); for (String n : names.replace(',', ';').split(";")) {
}
mqnames.add(mqname);
String namex = mqConf.getValue("names");
if (namex != null && !namex.isEmpty()) {
for (String n : namex.split(";")) {
if (n.trim().isEmpty()) { if (n.trim().isEmpty()) {
continue; continue;
} }
@@ -658,7 +653,7 @@ public final class Application {
if (propertiesConf != null) { if (propertiesConf != null) {
final Properties agentEnvs = new Properties(); final Properties agentEnvs = new Properties();
if (propertiesConf.getValue("load") != null) { //本地配置项文件加载 if (propertiesConf.getValue("load") != null) { //本地配置项文件加载
for (String dfload : propertiesConf.getValue("load").split(";")) { for (String dfload : propertiesConf.getValue("load").replace(',', ';').split(";")) {
if (dfload.trim().isEmpty()) { if (dfload.trim().isEmpty()) {
continue; continue;
} }
@@ -1262,6 +1257,9 @@ public final class Application {
resourceFactory.register(sourceName, SearchSource.class, source); resourceFactory.register(sourceName, SearchSource.class, source);
} else { } else {
resourceFactory.register(sourceName, DataSource.class, source); resourceFactory.register(sourceName, DataSource.class, source);
if (source instanceof DataSqlSource) {
resourceFactory.register(sourceName, DataSqlSource.class, source);
}
} }
} }
return source; return source;
@@ -1273,6 +1271,9 @@ public final class Application {
resourceFactory.register(sourceName, SearchSource.class, source); resourceFactory.register(sourceName, SearchSource.class, source);
} else { } else {
resourceFactory.register(sourceName, DataSource.class, source); resourceFactory.register(sourceName, DataSource.class, source);
if (source instanceof DataSqlSource) {
resourceFactory.register(sourceName, DataSqlSource.class, source);
}
} }
logger.info("Load DataSource resourceName = '" + sourceName + "', source = " + source); logger.info("Load DataSource resourceName = '" + sourceName + "', source = " + source);
return source; return source;
@@ -1656,7 +1657,7 @@ public final class Application {
try { try {
if (!inited.getAndSet(true)) { //加载自定义的协议SOCKS if (!inited.getAndSet(true)) { //加载自定义的协议SOCKS
ClassFilter profilter = new ClassFilter(classLoader, NodeProtocol.class, NodeServer.class, (Class[]) null); ClassFilter profilter = new ClassFilter(classLoader, NodeProtocol.class, NodeServer.class, (Class[]) null);
ClassFilter.Loader.load(home, classLoader, ((excludelibs != null ? (excludelibs + ";") : "") + serconf.getValue("excludelibs", "")).split(";"), profilter); ClassFilter.Loader.load(home, classLoader, ((excludelibs != null ? (excludelibs + ";") : "") + serconf.getValue("excludelibs", "")).replace(',', ';').split(";"), profilter);
final Set<FilterEntry<NodeServer>> entrys = profilter.getFilterEntrys(); final Set<FilterEntry<NodeServer>> entrys = profilter.getFilterEntrys();
for (FilterEntry<NodeServer> entry : entrys) { for (FilterEntry<NodeServer> entry : entrys) {
final Class<? extends NodeServer> type = entry.getType(); final Class<? extends NodeServer> type = entry.getType();

View File

@@ -339,9 +339,6 @@ public abstract class NodeServer {
} }
DataSource source = application.loadDataSource(resourceName, false); DataSource source = application.loadDataSource(resourceName, false);
field.set(srcObj, source); field.set(srcObj, source);
if (source instanceof DataSqlSource) {
rf.register(resourceName, DataSqlSource.class, source);
}
return source; return source;
} catch (Exception e) { } catch (Exception e) {
logger.log(Level.SEVERE, "DataSource inject to " + srcObj + " error", e); logger.log(Level.SEVERE, "DataSource inject to " + srcObj + " error", e);