+ public synchronized Collection<Policy> getForRic(String ric) {
+ return multiMapGet(policiesRic, ric);
+ }
+
+ public synchronized Collection<Policy> getForType(String type) {
+ return multiMapGet(policiesType, type);
+ }
+
+ public synchronized Policy removeId(String id) {
+ Policy p = policiesId.get(id);
+ if (p != null) {
+ remove(p);
+ }
+ return p;
+ }
+
+ public synchronized void remove(Policy policy) {
+ policiesId.remove(policy.id());
+ multiMapRemove(policiesRic, policy.ric().name(), policy);
+ multiMapRemove(policiesService, policy.ownerServiceName(), policy);
+ multiMapRemove(policiesType, policy.type().name(), policy);
+ }
+
+ public synchronized int size() {
+ return policiesId.size();
+ }
+
+ public synchronized void clear() {
+ while (policiesId.size() > 0) {
+ Set<String> keys = policiesId.keySet();
+ removeId(keys.iterator().next());
+ }
+ }