mirror of https://github.com/apache/activemq.git
Merge pull request #479 from coheigea/AMQ-7423
AMQ-7423 - Remove synchronization from JAAS PropertiesLoader
This commit is contained in:
commit
51081e4edf
|
@ -45,9 +45,8 @@ public class AuthorizationEntry extends DestinationMapEntry {
|
|||
return groupClass;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private Set<Object> emptySet() {
|
||||
return Collections.EMPTY_SET;
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
public void setGroupClass(String groupClass) {
|
||||
|
|
|
@ -24,8 +24,6 @@ import java.util.*;
|
|||
import org.apache.activemq.command.ActiveMQDestination;
|
||||
import org.apache.activemq.filter.DestinationMap;
|
||||
import org.apache.activemq.filter.DestinationMapEntry;
|
||||
import org.apache.activemq.filter.DestinationMapNode;
|
||||
import org.apache.activemq.filter.DestinationNode;
|
||||
|
||||
/**
|
||||
* Represents a destination based configuration of policies so that individual
|
||||
|
|
|
@ -16,8 +16,6 @@
|
|||
*/
|
||||
package org.apache.activemq.filter;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
import org.apache.activemq.command.*;
|
||||
|
||||
/**
|
||||
|
|
|
@ -17,14 +17,15 @@
|
|||
package org.apache.activemq.jaas;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class PropertiesLoader {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(PropertiesLoader.class);
|
||||
static final Map<FileNameKey, ReloadableProperties> staticCache = new HashMap<FileNameKey, ReloadableProperties>();
|
||||
private static final Map<FileNameKey, ReloadableProperties> staticCache = new ConcurrentHashMap<FileNameKey, ReloadableProperties>();
|
||||
protected boolean debug;
|
||||
|
||||
public void init(Map options) {
|
||||
|
@ -35,18 +36,10 @@ public class PropertiesLoader {
|
|||
}
|
||||
|
||||
public ReloadableProperties load(String nameProperty, String fallbackName, Map options) {
|
||||
ReloadableProperties result;
|
||||
FileNameKey key = new FileNameKey(nameProperty, fallbackName, options);
|
||||
key.setDebug(debug);
|
||||
|
||||
synchronized (staticCache) {
|
||||
result = staticCache.get(key);
|
||||
if (result == null) {
|
||||
result = new ReloadableProperties(key);
|
||||
staticCache.put(key, result);
|
||||
}
|
||||
}
|
||||
|
||||
ReloadableProperties result = staticCache.computeIfAbsent(key, k -> new ReloadableProperties(k));
|
||||
return result.obtained();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue