2 * Copyright (c) 2015 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.controller.cluster.datastore;
10 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeListener;
11 import org.opendaylight.controller.md.sal.dom.store.impl.DOMImmutableDataChangeEvent;
12 import org.opendaylight.controller.md.sal.dom.store.impl.DataChangeListenerRegistration;
13 import org.opendaylight.yangtools.util.concurrent.NotificationManager;
14 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
15 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
16 import org.slf4j.Logger;
17 import org.slf4j.LoggerFactory;
19 final class ShardDataTreeNotificationManager implements NotificationManager<DataChangeListenerRegistration<?>, DOMImmutableDataChangeEvent> {
20 private static final Logger LOG = LoggerFactory.getLogger(ShardDataTreeNotificationManager.class);
23 public void submitNotification(final DataChangeListenerRegistration<?> listener, final DOMImmutableDataChangeEvent notification) {
24 LOG.debug("Notifying listener {} about {}", listener.getInstance(), notification);
26 listener.getInstance().onDataChanged(notification);
30 public void submitNotifications(final DataChangeListenerRegistration<?> listener, final Iterable<DOMImmutableDataChangeEvent> notifications) {
31 final AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>> instance = listener.getInstance();
32 LOG.debug("Notifying listener {} about {}", instance, notifications);
34 for (DOMImmutableDataChangeEvent n : notifications) {
35 instance.onDataChanged(n);