You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shenyu.apache.org by GitBox <gi...@apache.org> on 2021/11/02 09:46:13 UTC

[GitHub] [incubator-shenyu] yu199195 commented on a change in pull request #2293: [type:refactor] optimize dubbo ReferenceConfig destroy

yu199195 commented on a change in pull request #2293:
URL: https://github.com/apache/incubator-shenyu/pull/2293#discussion_r740879451



##########
File path: shenyu-plugin/shenyu-plugin-dubbo/shenyu-plugin-apache-dubbo/src/main/java/org/apache/shenyu/plugin/apache/dubbo/cache/ApplicationConfigCache.java
##########
@@ -56,16 +55,7 @@
             .removalListener(notification -> {
                 ReferenceConfig<GenericService> config = (ReferenceConfig<GenericService>) notification.getValue();
                 if (config != null) {
-                    try {
-                        Class<?> cz = config.getClass();
-                        Field field = cz.getDeclaredField("ref");
-                        field.setAccessible(true);
-                        // After the configuration change, Dubbo destroys the instance, but does not empty it. If it is not handled,
-                        // it will get NULL when reinitializing and cause a NULL pointer problem.
-                        field.set(config, null);
-                    } catch (NoSuchFieldException | IllegalAccessException e) {
-                        LOG.error("modify ref have exception", e);
-                    }
+                    config.destroy();

Review comment:
       config.destroy();  maybe have some error




-- 
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: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org