mxsm commented on code in PR #3073:
URL: 
https://github.com/apache/incubator-eventmesh/pull/3073#discussion_r1103529381


##########
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:
   > This approach, destroying the original object, what do you think
   
   @eight-nines  agree! since jdk9 this method is deprecated.  use canAccess is 
true. 
   
![image](https://user-images.githubusercontent.com/15797831/218241907-1ef00562-a460-4ea0-873c-a2c2d63798fc.png)
   



-- 
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]

Reply via email to