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.opendaylight.yangtools.yang.common.Empty;
18 import org.slf4j.Logger;
19 import org.slf4j.LoggerFactory;
22 * A single notification event in the notification router.
24 final class DOMNotificationRouterEvent {
25 private static final Logger LOG = LoggerFactory.getLogger(DOMNotificationRouterEvent.class);
27 private final SettableFuture<Empty> future = SettableFuture.create();
28 private final @NonNull DOMNotification notification;
30 DOMNotificationRouterEvent(final DOMNotification notification) {
31 this.notification = requireNonNull(notification);
34 ListenableFuture<Empty> future() {
38 @SuppressWarnings("checkstyle:illegalCatch")
39 void deliverTo(final DOMNotificationListener listener) {
41 listener.onNotification(notification);
42 } catch (Exception e) {
43 LOG.warn("Listener {} failed during notification delivery", listener, e);
50 future.set(Empty.value());