You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2022/06/29 02:24:13 UTC

[GitHub] [dubbo] linjianming02 commented on a diff in pull request #10229: refactor: optimize ExtensionLoader code style

linjianming02 commented on code in PR #10229:
URL: https://github.com/apache/dubbo/pull/10229#discussion_r909141132


##########
dubbo-common/src/main/java/org/apache/dubbo/common/extension/ExtensionLoader.java:
##########
@@ -436,18 +425,8 @@ public T getExtension(String name, boolean wrap) {
         if ("true".equals(name)) {
             return getDefaultExtension();
         }
-        final Holder<Object> holder = getOrCreateHolder(name);
-        Object instance = holder.get();
-        if (instance == null) {
-            synchronized (holder) {
-                instance = holder.get();
-                if (instance == null) {
-                    instance = createExtension(name, wrap);
-                    holder.set(instance);
-                }
-            }
-        }
-        return (T) instance;
+        final T instance = cachedInstances.get(name);

Review Comment:
   Has been modified



-- 
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@dubbo.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org