dugenkui03 commented on PR #4138: URL: https://github.com/apache/rocketmq/pull/4138#issuecomment-1094296953
> Why not use ConcurrentHashMap instead of HashMap?Using ConcurrentHashMap, no need to lock when reading, and the scope of locking is smaller when writing. That's my opinion: Do as little as possible to fix mistakes. # describe in Chinese 这是我做bug-fix的观点:做尽可能少的事情去修正错误。进行更进一步的优化则是另外一件事情。 我理解这里使用`synchronized`的原因是jvm对`synchronized`加锁进行了优化:如果加锁代码块没有真实的发生多线程并发访问,则永远不会真正的加锁。 -- 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]
