Code Review
/
nonrtric.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Added RIC state to RicInfo in the agent NBI
[nonrtric.git]
/
policy-agent
/
src
/
main
/
java
/
org
/
oransc
/
policyagent
/
repository
/
Services.java
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
2e1d8da
..
f829c7c
100644
(file)
--- a/
policy-agent/src/main/java/org/oransc/policyagent/repository/Services.java
+++ b/
policy-agent/src/main/java/org/oransc/policyagent/repository/Services.java
@@
-22,6
+22,7
@@
package org.oransc.policyagent.repository;
import java.util.HashMap;
import java.util.Map;
import java.util.HashMap;
import java.util.Map;
+import java.util.Vector;
import org.oransc.policyagent.exceptions.ServiceException;
import org.slf4j.Logger;
import org.oransc.policyagent.exceptions.ServiceException;
import org.slf4j.Logger;
@@
-30,13
+31,10
@@
import org.slf4j.LoggerFactory;
public class Services {
private static final Logger logger = LoggerFactory.getLogger(Services.class);
public class Services {
private static final Logger logger = LoggerFactory.getLogger(Services.class);
- private Map<String, Service> services = new HashMap<>();
-
- public Services() {
- }
+ private Map<String, Service> registeredServices = new HashMap<>();
public synchronized Service getService(String name) throws ServiceException {
public synchronized Service getService(String name) throws ServiceException {
- Service s =
s
ervices.get(name);
+ Service s =
registeredS
ervices.get(name);
if (s == null) {
throw new ServiceException("Could not find service: " + name);
}
if (s == null) {
throw new ServiceException("Could not find service: " + name);
}
@@
-44,16
+42,27
@@
public class Services {
}
public synchronized Service get(String name) {
}
public synchronized Service get(String name) {
- return
s
ervices.get(name);
+ return
registeredS
ervices.get(name);
}
public synchronized void put(Service service) {
}
public synchronized void put(Service service) {
- logger.debug("Put service:
" +
service.getName());
-
s
ervices.put(service.getName(), service);
+ logger.debug("Put service:
{}",
service.getName());
+
registeredS
ervices.put(service.getName(), service);
}
public synchronized Iterable<Service> getAll() {
}
public synchronized Iterable<Service> getAll() {
- return services.values();
+ return new Vector<>(registeredServices.values());
+ }
+
+ public synchronized void remove(String name) {
+ registeredServices.remove(name);
}
}
+ public synchronized int size() {
+ return registeredServices.size();
+ }
+
+ public void clear() {
+ registeredServices.clear();
+ }
}
}