Merge pull request #508 from coheigea/AMQ-7440

AMQ-7440 - Fix potential race condition in DiscoveryRegistryServlet
This commit is contained in:
Jean-Baptiste Onofré 2020-05-16 06:22:52 +02:00 committed by GitHub
commit 2ec18730c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 6 deletions

View File

@ -49,12 +49,7 @@ public class DiscoveryRegistryServlet extends HttpServlet {
}
private ConcurrentMap<String, Long> getServiceGroup(String group) {
ConcurrentMap<String, Long> rc = serviceGroups.get(group);
if( rc == null ) {
rc = new ConcurrentHashMap<String, Long>();
serviceGroups.put(group, rc);
}
return rc;
return serviceGroups.computeIfAbsent(group, k -> new ConcurrentHashMap<String, Long>());
}
@Override