X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-rest-connector%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fstreams%2Flisteners%2FNotificator.java;h=cf1bcd6a30b6c4d22464e3678f2c468a995479c8;hp=a576eed26978fb0380cd8a28613712409bf6ce53;hb=de3e413b633b7555ae8f3fe2ec163dbb7dda5da8;hpb=0a2c659c014737c7e12a39001310de14d5f85149 diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/streams/listeners/Notificator.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/streams/listeners/Notificator.java index a576eed269..cf1bcd6a30 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/streams/listeners/Notificator.java +++ b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/streams/listeners/Notificator.java @@ -12,8 +12,7 @@ import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; - -import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; /** * {@link Notificator} is responsible to create, remove and find {@link ListenerAdapter} listener. @@ -21,7 +20,7 @@ import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier; public class Notificator { private static Map listenersByStreamName = new ConcurrentHashMap<>(); - private static Map listenersByInstanceIdentifier = new ConcurrentHashMap<>(); + private static Map listenersByInstanceIdentifier = new ConcurrentHashMap<>(); private static final Lock lock = new ReentrantLock(); private Notificator() { @@ -34,7 +33,6 @@ public class Notificator { return listenersByStreamName.keySet(); } - /** * Gets {@link ListenerAdapter} specified by stream name. * @@ -47,42 +45,37 @@ public class Notificator { } /** - * Gets {@link ListenerAdapter} listener specified by - * {@link InstanceIdentifier} path. + * Gets {@link ListenerAdapter} listener specified by {@link YangInstanceIdentifier} path. * * @param path * Path to data in data repository. * @return ListenerAdapter */ - public static ListenerAdapter getListenerFor(InstanceIdentifier path) { + public static ListenerAdapter getListenerFor(YangInstanceIdentifier path) { return listenersByInstanceIdentifier.get(path); } /** - * Checks if the listener specified by {@link InstanceIdentifier} path - * exist. + * Checks if the listener specified by {@link YangInstanceIdentifier} path exist. * * @param path * Path to data in data repository. * @return True if the listener exist, false otherwise. */ - public static boolean existListenerFor(InstanceIdentifier path) { + public static boolean existListenerFor(YangInstanceIdentifier path) { return listenersByInstanceIdentifier.containsKey(path); } /** - * Creates new {@link ListenerAdapter} listener from - * {@link InstanceIdentifier} path and stream name. + * Creates new {@link ListenerAdapter} listener from {@link YangInstanceIdentifier} path and stream name. * * @param path * Path to data in data repository. * @param streamName * The name of the stream. - * @return New {@link ListenerAdapter} listener from - * {@link InstanceIdentifier} path and stream name. + * @return New {@link ListenerAdapter} listener from {@link YangInstanceIdentifier} path and stream name. */ - public static ListenerAdapter createListener(InstanceIdentifier path, - String streamName) { + public static ListenerAdapter createListener(YangInstanceIdentifier path, String streamName) { ListenerAdapter listener = new ListenerAdapter(path, streamName); try { lock.lock(); @@ -95,20 +88,18 @@ public class Notificator { } /** - * Looks for listener determined by {@link InstanceIdentifier} path and - * removes it. + * Looks for listener determined by {@link YangInstanceIdentifier} path and removes it. * * @param path * InstanceIdentifier */ - public static void removeListener(InstanceIdentifier path) { + public static void removeListener(YangInstanceIdentifier path) { ListenerAdapter listener = listenersByInstanceIdentifier.get(path); deleteListener(listener); } /** - * Creates String representation of stream name from URI. Removes slash from - * URI in start and end position. + * Creates String representation of stream name from URI. Removes slash from URI in start and end position. * * @param uri * URI for creation stream name. @@ -148,14 +139,12 @@ public class Notificator { } /** - * Checks if listener has at least one subscriber. In case it doesn't have any, delete - * listener. + * Checks if listener has at least one subscriber. In case it doesn't have any, delete listener. * * @param listener * ListenerAdapter */ - public static void removeListenerIfNoSubscriberExists( - ListenerAdapter listener) { + public static void removeListenerIfNoSubscriberExists(ListenerAdapter listener) { if (!listener.hasSubscribers()) { deleteListener(listener); }