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/03/30 07:44:09 UTC

[GitHub] [dubbo] chickenlj commented on pull request #9831: SimpleReferenceCache bug to cause genericInvoke high lantency(fix: #9829)

chickenlj commented on pull request #9831:
URL: https://github.com/apache/dubbo/pull/9831#issuecomment-1082738793


   Will the following change enough to solve this issue?
   
   ```java
       @Override
       @SuppressWarnings("unchecked")
       public <T> T get(ReferenceConfigBase<T> rc) {
           String key = generator.generateKey(rc);
           Class<?> type = rc.getInterfaceClass();
   
           Object proxy = references.computeIfAbsent(rc, _rc -> {
               List<ReferenceConfigBase<?>> referencesOfType = referenceTypeMap.computeIfAbsent(type, _t -> Collections.synchronizedList(new ArrayList<>()));
               referencesOfType.add(rc);
               List<ReferenceConfigBase<?>> referenceConfigList = referenceKeyMap.computeIfAbsent(key, _k -> Collections.synchronizedList(new ArrayList<>()));
               referenceConfigList.add(rc);
               return _rc.get();
           });
   
           return (T) proxy;
       }
   ```


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