Renamed Data(ReadOnly|WriteOnly) to DataTree(Read|Write)
[mdsal.git] / common / mdsal-common-api / src / main / java / org / opendaylight / mdsal / common / api / AsyncDataChangeListener.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.mdsal.common.api;
9
10 import java.util.EventListener;
11 import org.opendaylight.yangtools.concepts.Path;
12
13 /**
14  * Listener of data change events on particular subtree.
15  *
16  * <p>
17  * User-supplied implementations of this listener interface MUST register via
18  * {@link AsyncDataBroker#registerDataChangeListener(LogicalDatastoreType, Path, AsyncDataChangeListener, AsyncDataBroker.DataChangeScope)}
19  * in order to start receiving data change events, which capture state changes
20  * in a subtree.
21  *
22  * <p>
23  * <b>Implementation Note:</b> This interface is intended to be implemented
24  * by users of MD-SAL.
25  *
26  * @param <P>
27  *            Type of path (subtree identifier), which represents location in
28  *            tree
29  * @param <D>
30  *            Type of data (payload), which represents data payload
31  */
32 public interface AsyncDataChangeListener<P extends Path<P>, D> extends EventListener {
33     /**
34      *
35      * Invoked when there is data change for the particular path, which was used to register this
36      * listener.
37      * <p>
38      * This method may be also invoked during registration of the listener if there is any
39      * preexisting data in the conceptual data tree for supplied path. This initial event will
40      * contain all preexisting data as created.
41      *
42      * <p>
43      * <b>Note</b>: This method may be invoked from a shared thread pool.
44      * <ul>
45      * <li>Implementations <b>SHOULD NOT</b> perform CPU-intensive operations on the calling thread.
46      * <li>Implementations <b>MUST NOT block the calling thread</b> - to do so could lead to
47      * deadlock scenarios.
48      * </ul>
49      *
50      * <br>
51      *
52      * @param change Data Change Event being delivered.
53      */
54     void onDataChanged(AsyncDataChangeEvent<P, D> change);
55 }