X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=policy-agent%2Fsrc%2Fmain%2Fjava%2Forg%2Foransc%2Fpolicyagent%2Frepository%2FServices.java;h=1c0e15aaeeec42601e36c4a4b158858fc5c6502b;hb=eb96c00343d525921bec628f7455c6227f191ef6;hp=f6c55dc432c580264a76285d07675a6cab8af673;hpb=136e826cabebb7e4188c68ec118bb11632f8139a;p=nonrtric.git diff --git a/policy-agent/src/main/java/org/oransc/policyagent/repository/Services.java b/policy-agent/src/main/java/org/oransc/policyagent/repository/Services.java index f6c55dc4..1c0e15aa 100644 --- a/policy-agent/src/main/java/org/oransc/policyagent/repository/Services.java +++ b/policy-agent/src/main/java/org/oransc/policyagent/repository/Services.java @@ -20,9 +20,9 @@ package org.oransc.policyagent.repository; -import java.util.Collections; import java.util.HashMap; import java.util.Map; +import java.util.Vector; import org.oransc.policyagent.exceptions.ServiceException; import org.slf4j.Logger; @@ -47,11 +47,12 @@ public class Services { public synchronized void put(Service service) { logger.debug("Put service: {}", service.getName()); + service.keepAlive(); registeredServices.put(service.getName(), service); } public synchronized Iterable getAll() { - return Collections.unmodifiableCollection(registeredServices.values()); + return new Vector<>(registeredServices.values()); } public synchronized void remove(String name) { @@ -62,7 +63,7 @@ public class Services { return registeredServices.size(); } - public void clear() { + public synchronized void clear() { registeredServices.clear(); } }