dubbo
dubbo copied to clipboard
optimize putIfAbsent method to computeIfAbsent which may reduce some creation of object
- [x] I have searched the issues of this repository and believe that this is not a duplicate.
- [x] I have checked the FAQ of this repository and believe that this is not a duplicate.
Environment
- Dubbo version: 2.7.10
- Operating System version: macOS
- Java version: 1.8
Steps to reproduce this issue
When using method "putIfAbsent" of concurrentHashMap to produce singleton,It may create extra duplicate Object .It's better to use "computeIfAbsent" as is mentioned in java doc " The most common usage is to construct a new object serving as an initial mapped value or memoized result"