public final class PingPongDataBroker extends ForwardingDOMDataBroker implements AutoCloseable, DOMDataTreeChangeService
DOMDataBroker
, which forwards most requests to a delegate.
Its interpretation of the API contract is somewhat looser, specifically it does not guarantee transaction ordering between transactions allocated directly from the broker and its transaction chains.
Constructor and Description |
---|
PingPongDataBroker(@NonNull DOMDataBroker delegate)
Instantiate a new broker, backed by the the specified delegate
DOMDataBroker . |
Modifier and Type | Method and Description |
---|---|
void |
close() |
PingPongTransactionChain |
createTransactionChain(DOMTransactionChainListener listener)
Create a new transaction chain.
|
protected DOMDataBroker |
delegate() |
<L extends DOMDataTreeChangeListener> |
registerDataTreeChangeListener(DOMDataTreeIdentifier treeId,
L listener)
Registers a
DOMDataTreeChangeListener to receive notifications when data changes
under a given path in the conceptual data tree. |
String |
toString() |
getExtensions, newReadOnlyTransaction, newReadWriteTransaction, newWriteOnlyTransaction
public PingPongDataBroker(@NonNull DOMDataBroker delegate)
DOMDataBroker
.delegate
- Backend broker, may not be null.protected DOMDataBroker delegate()
delegate
in class ForwardingDOMDataBroker
public PingPongTransactionChain createTransactionChain(DOMTransactionChainListener listener)
DOMDataBroker
createTransactionChain
in interface DOMDataBroker
createTransactionChain
in class ForwardingDOMDataBroker
listener
- Transaction chain event listenerpublic void close()
close
in interface AutoCloseable
public <L extends DOMDataTreeChangeListener> org.opendaylight.yangtools.concepts.ListenerRegistration<L> registerDataTreeChangeListener(DOMDataTreeIdentifier treeId, L listener)
DOMDataTreeChangeService
DOMDataTreeChangeListener
to receive notifications when data changes
under a given path in the conceptual data tree.
You are able to register for notifications for any node or subtree which can be represented
using DOMDataTreeIdentifier
.
You are able to register for data change notifications for a subtree or leaf even if it does not exist. You will receive notification once that node is created.
If there is any pre-existing data in the data tree for the path for which you are registering, you will receive an initial data change event, which will contain all pre-existing data, marked as created.
This method returns a ListenerRegistration
object. To "unregister" your listener for
changes call the ListenerRegistration.close()
method on the returned object.
You MUST explicitly unregister your listener when you no longer want to receive notifications. This is especially true in OSGi environments, where failure to do so during bundle shutdown can lead to stale listeners being still registered.
registerDataTreeChangeListener
in interface DOMDataTreeChangeService
L
- Listener typetreeId
- Data tree identifier of the subtree which should be watched for changes.listener
- Listener instance which is being registeredListenerRegistration.close()
to stop delivery of change events.public String toString()
toString
in class com.google.common.collect.ForwardingObject
Copyright © 2019 OpenDaylight. All rights reserved.