aboutsummaryrefslogtreecommitdiffstats
path: root/appc-client/client-lib/src/main/java
diff options
context:
space:
mode:
authorJakub Dudycz <jakub.dudycz@nokia.com>2018-01-25 18:12:01 +0100
committerPatrick Brady <pb071s@att.com>2018-01-26 17:14:05 +0000
commitabe171a152e193787b21404503542241654ea891 (patch)
tree55d1a2662fbd9c447a24f0f3860c63cb89a98807 /appc-client/client-lib/src/main/java
parent5cd7ee0c6e5e1e52577c399fd2a3da4da589f59b (diff)
CoreRegistry fixes
Change-Id: Ib2a54d01b038ea760b8d6078334067009b528e4f Issue-ID: APPC-527 Signed-off-by: Jakub Dudycz <jakub.dudycz@nokia.com>
Diffstat (limited to 'appc-client/client-lib/src/main/java')
-rw-r--r--appc-client/client-lib/src/main/java/org/onap/appc/client/impl/core/CoreRegistry.java29
1 files changed, 15 insertions, 14 deletions
diff --git a/appc-client/client-lib/src/main/java/org/onap/appc/client/impl/core/CoreRegistry.java b/appc-client/client-lib/src/main/java/org/onap/appc/client/impl/core/CoreRegistry.java
index e0a0c5b34..d12a44018 100644
--- a/appc-client/client-lib/src/main/java/org/onap/appc/client/impl/core/CoreRegistry.java
+++ b/appc-client/client-lib/src/main/java/org/onap/appc/client/impl/core/CoreRegistry.java
@@ -27,16 +27,15 @@ package org.onap.appc.client.impl.core;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
-/** client lib Registry
+/**
+ * client lib Registry
*/
-class CoreRegistry<T>{
- private Map<String, T> registry =
- new ConcurrentHashMap<String, T>();
+class CoreRegistry<T> {
- final private EmptyRegistryCallback emptyRegistryCallback;
+ private final EmptyRegistryCallback emptyRegistryCallback;
+ private Map<String, T> registry = new ConcurrentHashMap<>();
-
- CoreRegistry(EmptyRegistryCallback emptyRegistryCallback){
+ CoreRegistry(EmptyRegistryCallback emptyRegistryCallback) {
this.emptyRegistryCallback = emptyRegistryCallback;
}
@@ -44,27 +43,29 @@ class CoreRegistry<T>{
registry.put(key, obj);
}
- <T> T unregister(String key) {
- T item = (T) registry.remove(key);
- if(registry.isEmpty()) {
+ T unregister(String key) {
+ T item = registry.remove(key);
+ if (registry.isEmpty()) {
emptyRegistryCallback.emptyCallback();
}
return item;
}
- <T> T get(String key){
- return (T) registry.get(key);
+ T get(String key) {
+ return registry.get(key);
}
synchronized boolean isExist(String key) {
return registry.containsKey(key);
}
- boolean isEmpty(){
+ boolean isEmpty() {
return registry.isEmpty();
}
- public interface EmptyRegistryCallback{
+ @FunctionalInterface
+ public interface EmptyRegistryCallback {
+
void emptyCallback();
}
}