summaryrefslogtreecommitdiffstats
path: root/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/queue/ServiceListCache.java
diff options
context:
space:
mode:
Diffstat (limited to 'apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/queue/ServiceListCache.java')
-rw-r--r--apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/queue/ServiceListCache.java35
1 files changed, 35 insertions, 0 deletions
diff --git a/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/queue/ServiceListCache.java b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/queue/ServiceListCache.java
new file mode 100644
index 0000000..59be2e4
--- /dev/null
+++ b/apiroute/apiroute-service/src/main/java/org/onap/msb/apiroute/wrapper/queue/ServiceListCache.java
@@ -0,0 +1,35 @@
+package org.onap.msb.apiroute.wrapper.queue;
+
+import java.util.HashSet;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public class ServiceListCache {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(ServiceListCache.class);
+
+ private final static AtomicReference<Set<String>> serviceNameList4Cache = new AtomicReference<Set<String>>(new HashSet<String>());
+
+ public static Set<String> getLatestServiceNamelist() {
+ return serviceNameList4Cache.get();
+ }
+
+ public static void setLatestServiceNamelist(Set<String> newServicenamelist){
+ serviceNameList4Cache.set(newServicenamelist);
+ LOGGER.info("------current total Watch Service Num :"+ newServicenamelist.size());
+ }
+
+ public synchronized static void removeService(String serviceName){
+
+ Set<String> servicenamelist=serviceNameList4Cache.get();
+ servicenamelist.remove(serviceName);
+ serviceNameList4Cache.set(servicenamelist);
+ LOGGER.info("------current total Watch Service Num :"+ servicenamelist.size());
+ }
+
+
+}