You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by lq...@apache.org on 2015/10/15 13:29:09 UTC

svn commit: r1708798 - /qpid/java/trunk/broker-plugins/access-control/src/main/java/org/apache/qpid/server/security/access/config/RuleSet.java

Author: lquack
Date: Thu Oct 15 11:29:09 2015
New Revision: 1708798

URL: http://svn.apache.org/viewvc?rev=1708798&view=rev
Log:
QPID-6791: [Java Broker] Wrap WeakHashMap in synchronizedMap to avoid deadlock

Patch by Rob Godfrey

Modified:
    qpid/java/trunk/broker-plugins/access-control/src/main/java/org/apache/qpid/server/security/access/config/RuleSet.java

Modified: qpid/java/trunk/broker-plugins/access-control/src/main/java/org/apache/qpid/server/security/access/config/RuleSet.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/access-control/src/main/java/org/apache/qpid/server/security/access/config/RuleSet.java?rev=1708798&r1=1708797&r2=1708798&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/access-control/src/main/java/org/apache/qpid/server/security/access/config/RuleSet.java (original)
+++ qpid/java/trunk/broker-plugins/access-control/src/main/java/org/apache/qpid/server/security/access/config/RuleSet.java Thu Oct 15 11:29:09 2015
@@ -66,7 +66,7 @@ public class RuleSet implements EventLog
 
     private final SortedMap<Integer, Rule> _rules = new TreeMap<Integer, Rule>();
     private final Map<Subject, Map<Operation, Map<ObjectType, List<Rule>>>> _cache =
-                        new WeakHashMap<Subject, Map<Operation, Map<ObjectType, List<Rule>>>>();
+                        Collections.synchronizedMap(new WeakHashMap<Subject, Map<Operation, Map<ObjectType, List<Rule>>>>());
     private final Map<String, Boolean> _config = new HashMap<String, Boolean>();
     private final EventLoggerProvider _eventLogger;
 
@@ -414,7 +414,7 @@ public class RuleSet implements EventLog
         Map<Operation, Map<ObjectType, List<Rule>>> operations = _cache.get(subject);
         if (operations == null)
         {
-            operations = new EnumMap<Operation, Map<ObjectType, List<Rule>>>(Operation.class);
+            operations = Collections.synchronizedMap(new EnumMap<Operation, Map<ObjectType, List<Rule>>>(Operation.class));
             _cache.put(subject, operations);
         }
 
@@ -422,7 +422,7 @@ public class RuleSet implements EventLog
         Map<ObjectType, List<Rule>> objects = operations.get(operation);
         if (objects == null)
         {
-            objects = new EnumMap<ObjectType, List<Rule>>(ObjectType.class);
+            objects = Collections.synchronizedMap(new EnumMap<ObjectType, List<Rule>>(ObjectType.class));
             operations.put(operation, objects);
         }
         return objects;



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org