Java – do calls to thread safe functions also need to be synchronized?

If I am using concurrenthashmap (where put is thread safe) and I provide a common function myput using concurrenthashmap put – do I need to synchronize my function@ H_ 403_ 7@

ConcurrentHashMap map;  
public void myPut(int something) {  
   this.map.put(something);  
}

Solution

Concurrent utilities, such as concurrent HashMap, are designed so that you don't need to synchronize: they handle thread safe access internally@ H_ 403_ 7@

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>