public class DataBrokerFailuresImpl extends ForwardingDataBroker implements DataBrokerFailures
| Constructor and Description |
|---|
DataBrokerFailuresImpl(DataBroker delegate) |
| Modifier and Type | Method and Description |
|---|---|
protected DataBroker |
delegate() |
void |
failButCommitAnyway()
To simulate scenarios where even though the transaction throws a
TransactionCommitFailedException (caused by
akka.pattern.AskTimeoutException) it eventually succeeds.
|
void |
failCommits(int howManyTimes,
TransactionCommitFailedException exception)
Fails N future Transaction commits.
|
void |
failCommits(TransactionCommitFailedException exception)
Fails all future Transaction commits.
|
void |
failReads(int howManyTimes,
ReadFailedException exception)
Fails N future reads.
|
void |
failReads(ReadFailedException exception)
Fails all future reads.
|
<T extends DataObject> |
handleRead(BiFunction<LogicalDatastoreType,InstanceIdentifier<T>,com.google.common.util.concurrent.FluentFuture<Optional<T>>> readMethod,
LogicalDatastoreType store,
InstanceIdentifier<T> path) |
ReadWriteTransaction |
newReadWriteTransaction()
Allocates new read-write transaction which provides a mutable view of the data tree.
|
WriteTransaction |
newWriteOnlyTransaction()
Allocates new write-only transaction based on latest state of data tree.
|
void |
unfailCommits()
|
void |
unfailReads()
|
createTransactionChain, newReadOnlyTransaction, registerDataTreeChangeListenerpublic DataBrokerFailuresImpl(DataBroker delegate)
protected DataBroker delegate()
delegate in class ForwardingDataBrokerpublic void failReads(ReadFailedException exception)
DataBrokerFailuresfailReads in interface DataBrokerFailuresexception - a ReadFailedException to throw from a
ReadOperations.read(LogicalDatastoreType, InstanceIdentifier) call.public void failReads(int howManyTimes,
ReadFailedException exception)
DataBrokerFailuresfailReads in interface DataBrokerFailureshowManyTimes - how many times to throw the passed exception, until it resets.exception - a ReadFailedException to throw from a
ReadOperations.read(LogicalDatastoreType, InstanceIdentifier) call.public void failCommits(TransactionCommitFailedException exception)
DataBrokerFailuresfailCommits in interface DataBrokerFailuresexception - an Exception to throw from a WriteTransaction.commit() method.public void failCommits(int howManyTimes,
TransactionCommitFailedException exception)
DataBrokerFailuresfailCommits in interface DataBrokerFailureshowManyTimes - how many times to throw the passed exception, until it resetsexception - an Exception to throw from a WriteTransaction.commit() method.public void unfailReads()
DataBrokerFailuresDataBrokerFailures.failReads(ReadFailedException) or DataBrokerFailures.failReads(int, ReadFailedException).unfailReads in interface DataBrokerFailurespublic void unfailCommits()
DataBrokerFailuresDataBrokerFailures.failCommits(TransactionCommitFailedException) or
DataBrokerFailures.failCommits(int, TransactionCommitFailedException).unfailCommits in interface DataBrokerFailurespublic void failButCommitAnyway()
DataBrokerFailuresfailButCommitAnyway in interface DataBrokerFailurespublic <T extends DataObject> com.google.common.util.concurrent.FluentFuture<Optional<T>> handleRead(BiFunction<LogicalDatastoreType,InstanceIdentifier<T>,com.google.common.util.concurrent.FluentFuture<Optional<T>>> readMethod, LogicalDatastoreType store, InstanceIdentifier<T> path)
public ReadWriteTransaction newReadWriteTransaction()
TransactionFactory
Preconditions for mutation of data tree are captured from the snapshot of data tree state, when the transaction
is allocated. If data was changed during transaction in an incompatible way then the commit of this transaction
will fail. See WriteTransaction.commit() for more details about conflicting and non-conflicting
changes and failure scenarios.
newReadWriteTransaction in interface TransactionFactorynewReadWriteTransaction in class ForwardingDataBrokerpublic WriteTransaction newWriteOnlyTransaction()
TransactionFactory
Preconditions for mutation of data tree are captured from the snapshot of data tree state, when the transaction
is allocated. If data was changed during transaction in an incompatible way then the commit of this transaction
will fail. See WriteTransaction.commit() for more details about conflicting and not-conflicting changes
and failure scenarios.
Since this transaction does not provide a view of the data it SHOULD BE used only by callers who are exclusive
writers (exporters of data) to the subtree they modify. This prevents optimistic lock failures as described in
WriteTransaction.commit().
Exclusivity of writers to particular subtree SHOULD BE enforced by external locking mechanism.
newWriteOnlyTransaction in interface TransactionFactorynewWriteOnlyTransaction in class ForwardingDataBrokerCopyright © 2019 OpenDaylight. All rights reserved.