AlbumenJ commented on code in PR #14603:
URL: https://github.com/apache/dubbo/pull/14603#discussion_r1740246225


##########
dubbo-common/src/main/java/org/apache/dubbo/common/beans/factory/ScopeBeanFactory.java:
##########
@@ -124,19 +110,16 @@ public <T> T getOrRegisterBean(Class<T> type) {
         return getOrRegisterBean(null, type);
     }
 
-    public <T> T getOrRegisterBean(String name, Class<T> type) {
-        T bean = getBean(name, type);
-        if (bean == null) {
-            // lock by type
-            synchronized (type) {
-                bean = getBean(name, type);
-                if (bean == null) {
-                    bean = createAndRegisterBean(name, type);
-                }
+    private static final Hashtable<Class<?>, ReentrantLock> typeLocks = new 
Hashtable<>();

Review Comment:
   Why not use `ConcurrentHashMap`?



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