API Clarity: Documented Async Data Broker APIs.
[controller.git] / opendaylight / md-sal / sal-common-api / src / main / java / org / opendaylight / controller / md / sal / common / api / data / 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.controller.md.sal.common.api.data;
9
10 import java.util.EventListener;
11
12 import org.opendaylight.yangtools.concepts.Path;
13
14 /**
15  * Listener of data change events on particular subtree.
16  *
17  * <p>
18  * User-supplied implementations of this listener interface MUST register via
19  * {@link AsyncDataBroker#registerDataChangeListener(LogicalDatastoreType, Path, AsyncDataChangeListener, AsyncDataBroker.DataChangeScope)}
20  * in order to start receiving data change events, which capture state changes
21  * in a subtree.
22  *
23  * <p>
24  * <b>Implementation Note:</b> This interface is intended to be implemented
25  * by users of MD-SAL.
26  *
27  * @param <P>
28  *            Type of path (subtree identifier), which represents location in
29  *            tree
30  * @param <D>
31  *            Type of data (payload), which represents data payload
32  */
33 public interface AsyncDataChangeListener<P extends Path<P>, D> extends EventListener {
34     /**
35      *
36      * Invoked when there is data change for the particular path, which was used to
37      * register this listener.
38      * <p>
39      * This method may be also invoked during registration of the listener if
40      * there is any preexisting data in the conceptual data tree for supplied path.
41      * This initial event will contain all preexisting data as created.
42      *
43      * <p>
44      * <b>Note</b> that this method may be invoked from a shared thread pool, so
45      * implementations SHOULD NOT perform CPU-intensive operations and they
46      * definitely MUST NOT invoke any potentially blocking operations.
47      *
48      * @param change
49      *            Data Change Event being delivered.
50      */
51     void onDataChanged(AsyncDataChangeEvent<P, D> change);
52 }