|
|
|
@ -60,6 +60,26 @@ public class ConfigurationKit {
|
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 在一个事务中修改配置 |
|
|
|
|
* 支持 让 configType, configTypes 缓存失效 |
|
|
|
|
* |
|
|
|
|
* @param configType 配置类 |
|
|
|
|
* @param runner 执行器 |
|
|
|
|
* @param configTypes 配置类(所有的配置类都会缓存失效) |
|
|
|
|
*/ |
|
|
|
|
public static void modify(Runner runner, Class<? extends Configuration> configType, Class<? extends Configuration>... configTypes) { |
|
|
|
|
Configurations.modify(new WorkerFacade(configType, configTypes) { |
|
|
|
|
@Override |
|
|
|
|
public void run() { |
|
|
|
|
if (runner != null) { |
|
|
|
|
runner.run(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 在一个事务中修改配置 |
|
|
|
|
* |
|
|
|
@ -81,4 +101,29 @@ public class ConfigurationKit {
|
|
|
|
|
} |
|
|
|
|
Configurations.modify(facade); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 在一个事务中修改配置 |
|
|
|
|
* 支持 让 configType, configTypes 失效 |
|
|
|
|
* |
|
|
|
|
* @param configType 配置类 |
|
|
|
|
* @param runner 执行器 |
|
|
|
|
* @param callBack 事务回调 |
|
|
|
|
* @param configTypes 配置类(所有的配置类都会缓存失效) |
|
|
|
|
*/ |
|
|
|
|
public static void modify(Runner runner, WorkerCallBack callBack, Class<? extends Configuration> configType, Class<? extends Configuration>... configTypes) { |
|
|
|
|
WorkerFacade facade = new WorkerFacade(configType, configTypes) { |
|
|
|
|
@Override |
|
|
|
|
public void run() { |
|
|
|
|
if (runner != null) { |
|
|
|
|
runner.run(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
if (callBack != null) { |
|
|
|
|
facade.addCallBack(callBack); |
|
|
|
|
} |
|
|
|
|
Configurations.modify(facade); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|