Ensure componentsByParentAndType in CachedRealm is returned as a concurrent multi-valued map
Closes #30235 Signed-off-by: Stefan Guilhen <sguilhen@redhat.com>
This commit is contained in:
parent
3887ee3006
commit
9b7cf9d584
2 changed files with 11 additions and 1 deletions
|
@ -18,6 +18,7 @@
|
|||
package org.keycloak.common.util;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
|
@ -28,6 +29,15 @@ import java.util.concurrent.CopyOnWriteArrayList;
|
|||
@SuppressWarnings("serial")
|
||||
public class ConcurrentMultivaluedHashMap<K, V> extends ConcurrentHashMap<K, List<V>> implements MultivaluedMap<K, V>
|
||||
{
|
||||
public ConcurrentMultivaluedHashMap() {
|
||||
}
|
||||
|
||||
public ConcurrentMultivaluedHashMap(Map<K, List<V>> map) {
|
||||
if (map == null) {
|
||||
throw new IllegalArgumentException("Map can not be null");
|
||||
}
|
||||
putAll(map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<V> createListInstance() {
|
||||
|
|
|
@ -696,7 +696,7 @@ public class CachedRealm extends AbstractExtendableRevisioned {
|
|||
}
|
||||
|
||||
public MultivaluedMap<String, ComponentModel> getComponentsByParentAndType() {
|
||||
return new MultivaluedHashMap<>(componentsByParentAndType);
|
||||
return new ConcurrentMultivaluedHashMap<>(componentsByParentAndType);
|
||||
}
|
||||
|
||||
public Map<String, ComponentModel> getComponents() {
|
||||
|
|
Loading…
Reference in a new issue