为什么concurrenthashmap是线程安全的

2025-04-24 00:26:40
推荐回答(1个)
回答1:

ConcurrentHashMap 只是保证本身map的线程安全,不保证你自己写的程序的同步.

你可以采用客户端加锁实现同步

synchronized(test.chm)