diff --git a/base/ca/src/main/java/com/netscape/ca/AuthorityMonitor.java b/base/ca/src/main/java/com/netscape/ca/AuthorityMonitor.java index a0ba0408b41..89dfe799989 100644 --- a/base/ca/src/main/java/com/netscape/ca/AuthorityMonitor.java +++ b/base/ca/src/main/java/com/netscape/ca/AuthorityMonitor.java @@ -51,6 +51,9 @@ public class AuthorityMonitor implements Runnable { public AsyncLoader loader = new AsyncLoader(10 /* 10s timeout */); public boolean foundHostCA; + public Map authorities = + Collections.synchronizedSortedMap(new TreeMap()); + public Map keyRetrievers = Collections.synchronizedSortedMap(new TreeMap()); diff --git a/base/ca/src/main/java/org/dogtagpki/server/ca/CAEngine.java b/base/ca/src/main/java/org/dogtagpki/server/ca/CAEngine.java index d12ff006a63..60523a3deab 100644 --- a/base/ca/src/main/java/org/dogtagpki/server/ca/CAEngine.java +++ b/base/ca/src/main/java/org/dogtagpki/server/ca/CAEngine.java @@ -33,7 +33,6 @@ import java.util.List; import java.util.Locale; import java.util.Map; -import java.util.TreeMap; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; @@ -163,9 +162,6 @@ public class CAEngine extends CMSEngine { protected LdapBoundConnFactory connectionFactory; - public static Map authorities = - Collections.synchronizedSortedMap(new TreeMap()); - protected AuthorityMonitor authorityMonitor; protected boolean enableAuthorityMonitor = true; @@ -990,8 +986,8 @@ public CertificateAuthority getCA() { */ public List getCAs() { List list = new ArrayList<>(); - synchronized (authorities) { - list.addAll(authorities.values()); + synchronized (authorityMonitor.authorities) { + list.addAll(authorityMonitor.authorities.values()); } return list; } @@ -1005,7 +1001,7 @@ public List getCAs() { * @return the authority, or null if not found */ public CertificateAuthority getCA(AuthorityID aid) { - return aid == null ? getCA() : authorities.get(aid); + return aid == null ? getCA() : authorityMonitor.authorities.get(aid); } public CertificateAuthority getCA(X500Name dn) { @@ -1019,11 +1015,11 @@ public CertificateAuthority getCA(X500Name dn) { } public void addCA(AuthorityID aid, CertificateAuthority ca) { - authorities.put(aid, ca); + authorityMonitor.authorities.put(aid, ca); } public void removeCA(AuthorityID aid) { - authorities.remove(aid); + authorityMonitor.authorities.remove(aid); authorityMonitor.entryUSNs.remove(aid); authorityMonitor.nsUniqueIds.remove(aid); } @@ -1159,7 +1155,7 @@ public CertificateAuthority createCA( } CertificateAuthority ca = createCA(parentCA, authToken, subjectDN, description); - authorities.put(ca.getAuthorityID(), ca); + authorityMonitor.authorities.put(ca.getAuthorityID(), ca); return ca; }