Jiaming1999 opened a new pull request #2189: URL: https://github.com/apache/incubator-shenyu/pull/2189
My PR is about fixing thread-safety about ConcurrentHashMap usage. The reports are automatically generated by Amazon AWS CodeGuru Reviewer. The problem: Usage of containsKey() and put() may not be thread-safe at lines: 54 and 59. Two threads can perform this same check at the same time and one thread can overwrite the value written by the other thread. My potential solution: Using putIfAbsent() to replace put(), by the logic of original code, the put should not be called again to update the existing key, so using putIfAbsent will automatically stop the operation if any thread put things first. -- 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]
