优化PropertiesAgent

This commit is contained in:
Redkale
2022-11-24 20:01:41 +08:00
parent 050ebc673a
commit 0b2f2b189c
2 changed files with 13 additions and 3 deletions

View File

@@ -17,10 +17,20 @@ import org.redkale.util.*;
*/
public abstract class PropertiesAgent {
public static final String PROP_KEY_URL = "url";
public static final String PROP_KEY_NAMESPACE = "namespace";
public static final String PROP_NAMESPACE_APPLICATION = "application";
public void compile(AnyValue conf) {
}
public abstract void init(ResourceFactory factory, Properties appProperties, AnyValue conf);
public abstract void destroy(AnyValue conf);
protected String getKeyResourceName(String key) {
return key.startsWith("property.") ? key : ("property." + key);
}
}

View File

@@ -875,13 +875,13 @@ public final class ResourceFactory {
if (element.listener != null) {
try {
oldVal = element.field.get(dest);
} catch (Exception e) {
} catch (Throwable e) {
e.printStackTrace();
}
}
try {
element.field.set(dest, newVal);
} catch (Exception e) {
} catch (Throwable e) {
e.printStackTrace();
}
if (element.listener != null) {
@@ -894,7 +894,7 @@ public final class ResourceFactory {
wrappers.add(new ResourceChangeWrapper(dest, element.listener, new ResourceChangeEvent(name, newVal, oldVal)));
}
}
} catch (Exception e) {
} catch (Throwable e) {
logger.log(Level.SEVERE, dest + " resource change listener error", e);
}
}