优化
This commit is contained in:
@@ -483,7 +483,7 @@ class AppConfig {
|
||||
}
|
||||
}
|
||||
|
||||
static final AnyValue.MergeFunction appConfigmergeFunction = (path, key, val1, val2) -> {
|
||||
static final AnyValue.MergeFunction APP_CONFIG_MERGE_FUNC = (path, key, val1, val2) -> {
|
||||
if ("".equals(path)) {
|
||||
if ("executor".equals(key)) {
|
||||
return AnyValue.MergeFunction.REPLACE;
|
||||
|
||||
@@ -248,8 +248,10 @@ public final class Application {
|
||||
|
||||
//设置基础信息资源
|
||||
this.resourceFactory.register(RESNAME_APP_NAME, String.class, this.name);
|
||||
|
||||
this.resourceFactory.register(RESNAME_APP_NODEID, int.class, this.nodeid);
|
||||
this.resourceFactory.register(RESNAME_APP_NODEID, Integer.class, this.nodeid);
|
||||
|
||||
this.resourceFactory.register(RESNAME_APP_TIME, long.class, this.startTime);
|
||||
this.resourceFactory.register(RESNAME_APP_TIME, Long.class, this.startTime);
|
||||
|
||||
@@ -706,7 +708,7 @@ public final class Application {
|
||||
Properties newDyncProps = new Properties();
|
||||
dyncProps.forEach((k, v) -> newDyncProps.put(k.toString(), getPropertyValue(v.toString(), dyncProps)));
|
||||
//合并配置
|
||||
this.config.merge(AnyValue.loadFromProperties(newDyncProps).getAnyValue("redkale"), AppConfig.appConfigmergeFunction);
|
||||
this.config.merge(AnyValue.loadFromProperties(newDyncProps).getAnyValue("redkale"), AppConfig.APP_CONFIG_MERGE_FUNC);
|
||||
}
|
||||
//使用合并后的新配置节点
|
||||
propsConf = this.config.getAnyValue("properties");
|
||||
|
||||
@@ -35,12 +35,24 @@ public abstract class AnyValue {
|
||||
*/
|
||||
public static interface MergeFunction {
|
||||
|
||||
/**
|
||||
* 追加
|
||||
*/
|
||||
public static final int NONE = 0;
|
||||
|
||||
/**
|
||||
* 替换
|
||||
*/
|
||||
public static final int REPLACE = 1;
|
||||
|
||||
/**
|
||||
* 合并
|
||||
*/
|
||||
public static final int MERGE = 2;
|
||||
|
||||
/**
|
||||
* 丢弃
|
||||
*/
|
||||
public static final int SKIP = 3;
|
||||
|
||||
public int apply(String path, String name, AnyValue val1, AnyValue val2);
|
||||
|
||||
Reference in New Issue
Block a user