X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-dom-broker%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fmd%2Fsal%2Fdom%2Fbroker%2Fimpl%2FDOMNotificationRouterEvent.java;h=47ff2c286958edacf8f6519bc355c5e2ef1c38a3;hp=0367cab3822b2fc5cda94122e1efb538eb74ab78;hb=3859df9beca8f13f1ff2b2744ed3470a1715bec3;hpb=073b32d836bb401d0295171152097591a355cbb9 diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMNotificationRouterEvent.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMNotificationRouterEvent.java index 0367cab382..47ff2c2869 100644 --- a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMNotificationRouterEvent.java +++ b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMNotificationRouterEvent.java @@ -7,10 +7,12 @@ */ package org.opendaylight.controller.md.sal.dom.broker.impl; -import com.google.common.base.Preconditions; +import static java.util.Objects.requireNonNull; + import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.SettableFuture; import com.lmax.disruptor.EventFactory; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import java.util.Collection; import org.opendaylight.controller.md.sal.dom.api.DOMNotification; import org.opendaylight.controller.md.sal.dom.api.DOMNotificationListener; @@ -22,14 +24,10 @@ import org.slf4j.LoggerFactory; * A single notification event in the disruptor ringbuffer. These objects are reused, * so they do have mutable state. */ +@Deprecated final class DOMNotificationRouterEvent { private static final Logger LOG = LoggerFactory.getLogger(DOMNotificationRouterEvent.class); - public static final EventFactory FACTORY = new EventFactory() { - @Override - public DOMNotificationRouterEvent newInstance() { - return new DOMNotificationRouterEvent(); - } - }; + public static final EventFactory FACTORY = DOMNotificationRouterEvent::new; private Collection> subscribers; private DOMNotification notification; @@ -39,9 +37,12 @@ final class DOMNotificationRouterEvent { // Hidden on purpose, initialized in initialize() } - ListenableFuture initialize(final DOMNotification notification, final Collection> subscribers) { - this.notification = Preconditions.checkNotNull(notification); - this.subscribers = Preconditions.checkNotNull(subscribers); + @SuppressWarnings("checkstyle:hiddenField") + ListenableFuture initialize(final DOMNotification notification, + final Collection> + subscribers) { + this.notification = requireNonNull(notification); + this.subscribers = requireNonNull(subscribers); this.future = SettableFuture.create(); return this.future; } @@ -50,23 +51,18 @@ final class DOMNotificationRouterEvent { LOG.trace("Start delivery of notification {}", notification); for (ListenerRegistration r : subscribers) { final DOMNotificationListener listener = r.getInstance(); - if (listener != null) { - try { - LOG.trace("Notifying listener {}", listener); - listener.onNotification(notification); - LOG.trace("Listener notification completed"); - } catch (Exception e) { - LOG.error("Delivery of notification {} caused an error in listener {}", notification, listener, e); - } - } + LOG.trace("Notifying listener {}", listener); + listener.onNotification(notification); + LOG.trace("Listener notification completed"); } LOG.trace("Delivery completed"); } + @SuppressFBWarnings(value = "NP_NONNULL_PARAM_VIOLATION", justification = "Void is the only allowed value") void setFuture() { future.set(null); notification = null; subscribers = null; future = null; } -} \ No newline at end of file +}