mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-18 06:22:29 +00:00
making it concurrency-safe
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@6388 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
1 parent
3115a12fcb
commit
4eafb3c90d
1 file changed
+5
-5
@@ -1,9 +1,9 @@
|
||||
package hudson.security;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
/**
|
||||
* Permission, which represents activity that requires a security privilege.
|
||||
@@ -48,7 +48,7 @@ public class Permission {
|
||||
synchronized (PERMISSIONS) {
|
||||
List<Permission> ps = PERMISSIONS.get(owner);
|
||||
if(ps==null) {
|
||||
ps = new ArrayList<Permission>();
|
||||
ps = new CopyOnWriteArrayList<Permission>();
|
||||
PERMISSIONS.put(owner,ps);
|
||||
}
|
||||
ps.add(this);
|
||||
@@ -71,12 +71,12 @@ public class Permission {
|
||||
/**
|
||||
* All the permissions in the system, keyed by their owners.
|
||||
*/
|
||||
private static final Map<Class,List<Permission>> PERMISSIONS = new HashMap<Class,List<Permission>>();
|
||||
private static final Map<Class,List<Permission>> PERMISSIONS = new ConcurrentHashMap<Class,List<Permission>>();
|
||||
|
||||
/**
|
||||
* The same as {@link #PERMISSIONS} but in a single list.
|
||||
*/
|
||||
private static final List<Permission> ALL = new ArrayList<Permission>();
|
||||
private static final List<Permission> ALL = new CopyOnWriteArrayList<Permission>();
|
||||
|
||||
//
|
||||
//
|
||||
|
||||
Reference in new issue
Block a user