This commit is contained in:
Looly
2023-12-29 12:38:14 +08:00
parent bca0f82bac
commit 03b8f57648
6 changed files with 46 additions and 48 deletions

View File

@@ -213,7 +213,7 @@ public class Setting extends AbsSetting implements Map<String, String> {
Assert.notNull(this.resource, "Setting resource must be not null !");
// 先关闭之前的监听
IoUtil.closeQuietly(this.watchMonitor);
this.watchMonitor = WatchUtil.createModify(resource.getUrl(), new SimpleWatcher() {
this.watchMonitor = WatchUtil.ofModify(resource.getUrl(), new SimpleWatcher() {
@Override
public void onModify(final WatchEvent<?> event, final WatchKey key) {
final boolean success = load();

View File

@@ -228,11 +228,9 @@ public final class Props extends Properties implements TypeGetter<CharSequence>
public void autoLoad(final boolean autoReload) {
if (autoReload) {
Assert.notNull(this.resource, "Properties resource must be not null!");
if (null != this.watchMonitor) {
// 先关闭之前的监听
this.watchMonitor.close();
}
this.watchMonitor = WatchUtil.createModify(this.resource.getUrl(), new SimpleWatcher() {
// 先关闭之前的监听
IoUtil.closeQuietly(this.watchMonitor);
this.watchMonitor = WatchUtil.ofModify(this.resource.getUrl(), new SimpleWatcher() {
@Override
public void onModify(final WatchEvent<?> event, final WatchKey key) {
load();