eight-nines commented on code in PR #3073:
URL:
https://github.com/apache/incubator-eventmesh/pull/3073#discussion_r1103492581
##########
eventmesh-common/src/main/java/org/apache/eventmesh/common/config/ConfigMonitorService.java:
##########
@@ -52,20 +52,16 @@ public void load() {
if (configInfo.getObject().equals(object)) {
continue;
}
-
Field field = configInfo.getObjectField();
- boolean isAccessible = field.isAccessible();
- try {
- field.setAccessible(true);
- field.set(configInfo.getInstance(), object);
- } finally {
- field.setAccessible(isAccessible);
- }
+ field.setAccessible(true);
+ field.set(configInfo.getInstance(), object);
configInfo.setObject(object);
log.info("config reload success: {}", object);
} catch (Exception e) {
log.error("config reload failed", e);
+ } finally {
+ configInfo.getObjectField().setAccessible(false);
Review Comment:
Yes, after you change it, the original object will always become false, not
the initial value; all, what if the initial value is true? And it will be used
elsewhere, what should be done?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]