2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.mdsal.dom.broker;
10 import static java.util.Objects.requireNonNull;
12 import com.google.common.util.concurrent.ListenableFuture;
13 import com.google.common.util.concurrent.SettableFuture;
14 import org.eclipse.jdt.annotation.NonNull;
15 import org.opendaylight.mdsal.dom.api.DOMNotification;
16 import org.opendaylight.mdsal.dom.api.DOMNotificationListener;
17 import org.slf4j.Logger;
18 import org.slf4j.LoggerFactory;
21 * A single notification event in the notification router.
23 final class DOMNotificationRouterEvent {
24 private static final Logger LOG = LoggerFactory.getLogger(DOMNotificationRouterEvent.class);
26 private final SettableFuture<Void> future = SettableFuture.create();
27 private final @NonNull DOMNotification notification;
29 DOMNotificationRouterEvent(final DOMNotification notification) {
30 this.notification = requireNonNull(notification);
33 ListenableFuture<Void> future() {
37 @SuppressWarnings("checkstyle:illegalCatch")
38 void deliverTo(DOMNotificationListener listener) {
40 listener.onNotification(notification);
41 } catch (Exception e) {
42 LOG.warn("Listener {} failed during notification delivery", listener, e);