AMQ-7440 - Fix potential race condition in DiscoveryRegistryServlet

This commit is contained in:
Colm O hEigeartaigh 2020-03-10 16:12:59 +00:00
parent c0e7949468
commit c44be3b0dd
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