X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=netconf%2Fmessagebus-netconf%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fnetconf%2Fmessagebus%2Feventsources%2Fnetconf%2FNotificationTopicRegistration.java;h=286ac1db35c35a2dddb4d01d19ce2d8b59fe562f;hb=e6de448d56108f88bb05d346b1dd225d273563c5;hp=d10ce66249f73cedcc961b9516c22b9a69fd2534;hpb=e913990a55194144eb16011ce7de8a23530e6147;p=netconf.git diff --git a/netconf/messagebus-netconf/src/main/java/org/opendaylight/netconf/messagebus/eventsources/netconf/NotificationTopicRegistration.java b/netconf/messagebus-netconf/src/main/java/org/opendaylight/netconf/messagebus/eventsources/netconf/NotificationTopicRegistration.java index d10ce66249..286ac1db35 100644 --- a/netconf/messagebus-netconf/src/main/java/org/opendaylight/netconf/messagebus/eventsources/netconf/NotificationTopicRegistration.java +++ b/netconf/messagebus-netconf/src/main/java/org/opendaylight/netconf/messagebus/eventsources/netconf/NotificationTopicRegistration.java @@ -7,9 +7,9 @@ */ package org.opendaylight.netconf.messagebus.eventsources.netconf; -import com.google.common.base.Optional; -import com.google.common.collect.Sets; -import java.util.Date; +import java.time.Instant; +import java.util.HashSet; +import java.util.Optional; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.messagebus.eventaggregator.rev141202.TopicId; @@ -20,6 +20,7 @@ import org.slf4j.LoggerFactory; /** * Notification topic registration. */ +@Deprecated(forRemoval = true) abstract class NotificationTopicRegistration implements AutoCloseable { private static final Logger LOG = LoggerFactory.getLogger(NotificationTopicRegistration.class); @@ -34,11 +35,11 @@ abstract class NotificationTopicRegistration implements AutoCloseable { private final String sourceName; private final String notificationUrnPrefix; private boolean replaySupported; - private Date lastEventTime; + private Instant lastEventTime; protected final ConcurrentHashMap> notificationTopicMap = new ConcurrentHashMap<>(); - protected NotificationTopicRegistration(NotificationSourceType notificationSourceType, String sourceName, - String notificationUrnPrefix) { + protected NotificationTopicRegistration(final NotificationSourceType notificationSourceType, + final String sourceName, final String notificationUrnPrefix) { this.notificationSourceType = notificationSourceType; this.sourceName = sourceName; this.notificationUrnPrefix = notificationUrnPrefix; @@ -50,7 +51,7 @@ abstract class NotificationTopicRegistration implements AutoCloseable { return active; } - protected void setActive(boolean active) { + protected void setActive(final boolean active) { this.active = active; } @@ -72,9 +73,9 @@ abstract class NotificationTopicRegistration implements AutoCloseable { * @param notificationPath path * @return topicIds */ - Set getTopicsForNotification(SchemaPath notificationPath) { + Set getTopicsForNotification(final SchemaPath notificationPath) { final Set topicIds = notificationTopicMap.get(notificationPath); - return topicIds != null ? topicIds : Sets.newHashSet(); + return topicIds != null ? topicIds : new HashSet<>(); } /** @@ -83,7 +84,7 @@ abstract class NotificationTopicRegistration implements AutoCloseable { * @param notificationPath path * @return true, if notification belongs to registration namespace */ - boolean checkNotificationPath(SchemaPath notificationPath) { + boolean checkNotificationPath(final SchemaPath notificationPath) { if (notificationPath == null) { return false; } @@ -93,11 +94,11 @@ abstract class NotificationTopicRegistration implements AutoCloseable { return nameSpace.startsWith(getNotificationUrnPrefix()); } - Optional getLastEventTime() { - return Optional.fromNullable(lastEventTime); + Optional getLastEventTime() { + return Optional.ofNullable(lastEventTime); } - void setLastEventTime(Date lastEventTime) { + void setLastEventTime(final Instant lastEventTime) { this.lastEventTime = lastEventTime; } @@ -120,7 +121,6 @@ abstract class NotificationTopicRegistration implements AutoCloseable { * Registers associated event source notification to topic. * * @param topicId topic id - * @return true, if successful */ abstract void unRegisterNotificationTopic(TopicId topicId); @@ -128,7 +128,7 @@ abstract class NotificationTopicRegistration implements AutoCloseable { return replaySupported; } - protected void setReplaySupported(boolean replaySupported) { + protected void setReplaySupported(final boolean replaySupported) { this.replaySupported = replaySupported; }