Class TransactionChainManager
- java.lang.Object
-
- org.opendaylight.openflowplugin.common.txchain.TransactionChainManager
-
- All Implemented Interfaces:
AutoCloseable
,EventListener
,org.opendaylight.mdsal.binding.api.TransactionChainListener
public class TransactionChainManager extends Object implements org.opendaylight.mdsal.binding.api.TransactionChainListener, AutoCloseable
The openflowplugin-impl.org.opendaylight.openflowplugin.impl.device package protected class for controllingWriteTransaction
life cycle. It is aTransactionChainListener
and provide package protected methods for writeToTransaction method (wrappedWriteOperations.put(LogicalDatastoreType, InstanceIdentifier, DataObject)
) and submitTransaction method (wrappedWriteTransaction.commit()
).
-
-
Constructor Summary
Constructors Constructor Description TransactionChainManager(@NonNull org.opendaylight.mdsal.binding.api.DataBroker dataBroker, @NonNull String deviceIdentifier)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
acquireWriteTransactionLock()
void
activateTransactionManager()
Method change status for TxChainManager to WORKING and it has to make registration for this class instance asTransactionChainListener
to provide possibility a make DS transactions.<T extends org.opendaylight.yangtools.yang.binding.DataObject>
voidaddDeleteOperationToTxChain(org.opendaylight.mdsal.common.api.LogicalDatastoreType store, org.opendaylight.yangtools.yang.binding.InstanceIdentifier<T> path)
void
close()
com.google.common.util.concurrent.FluentFuture<?>
deactivateTransactionManager()
Method change status for TxChainManger to SLEEPING and it unregisters this class instance asTransactionChainListener
so it broke a possibility to write something to DS.boolean
initialSubmitWriteTransaction()
<T extends org.opendaylight.yangtools.yang.binding.DataObject>
voidmergeToTransaction(org.opendaylight.mdsal.common.api.LogicalDatastoreType store, org.opendaylight.yangtools.yang.binding.InstanceIdentifier<T> path, T data, boolean createParents)
void
onTransactionChainFailed(org.opendaylight.mdsal.binding.api.TransactionChain chain, org.opendaylight.mdsal.binding.api.Transaction transaction, Throwable cause)
void
onTransactionChainSuccessful(org.opendaylight.mdsal.binding.api.TransactionChain chain)
<T extends org.opendaylight.yangtools.yang.binding.DataObject>
com.google.common.util.concurrent.ListenableFuture<Optional<T>>readFromTransaction(org.opendaylight.mdsal.common.api.LogicalDatastoreType store, org.opendaylight.yangtools.yang.binding.InstanceIdentifier<T> path)
void
releaseWriteTransactionLock()
com.google.common.util.concurrent.FluentFuture<?>
shuttingDown()
@org.checkerframework.checker.lock.qual.GuardedBy({"txLock"}) boolean
submitTransaction()
@org.checkerframework.checker.lock.qual.GuardedBy({"txLock"}) boolean
submitTransaction(boolean doSync)
<T extends org.opendaylight.yangtools.yang.binding.DataObject>
voidwriteToTransaction(org.opendaylight.mdsal.common.api.LogicalDatastoreType store, org.opendaylight.yangtools.yang.binding.InstanceIdentifier<T> path, T data, boolean createParents)
-
-
-
Constructor Detail
-
TransactionChainManager
public TransactionChainManager(@NonNull org.opendaylight.mdsal.binding.api.DataBroker dataBroker, @NonNull String deviceIdentifier)
-
-
Method Detail
-
initialSubmitWriteTransaction
public boolean initialSubmitWriteTransaction()
-
activateTransactionManager
public void activateTransactionManager()
Method change status for TxChainManager to WORKING and it has to make registration for this class instance asTransactionChainListener
to provide possibility a make DS transactions. Call this method for MASTER role only.
-
deactivateTransactionManager
public com.google.common.util.concurrent.FluentFuture<?> deactivateTransactionManager()
Method change status for TxChainManger to SLEEPING and it unregisters this class instance asTransactionChainListener
so it broke a possibility to write something to DS. Call this method for SLAVE only.- Returns:
- Future
-
submitTransaction
public @org.checkerframework.checker.lock.qual.GuardedBy({"txLock"}) boolean submitTransaction()
-
submitTransaction
public @org.checkerframework.checker.lock.qual.GuardedBy({"txLock"}) boolean submitTransaction(boolean doSync)
-
addDeleteOperationToTxChain
public <T extends org.opendaylight.yangtools.yang.binding.DataObject> void addDeleteOperationToTxChain(org.opendaylight.mdsal.common.api.LogicalDatastoreType store, org.opendaylight.yangtools.yang.binding.InstanceIdentifier<T> path)
-
writeToTransaction
public <T extends org.opendaylight.yangtools.yang.binding.DataObject> void writeToTransaction(org.opendaylight.mdsal.common.api.LogicalDatastoreType store, org.opendaylight.yangtools.yang.binding.InstanceIdentifier<T> path, T data, boolean createParents)
-
mergeToTransaction
public <T extends org.opendaylight.yangtools.yang.binding.DataObject> void mergeToTransaction(org.opendaylight.mdsal.common.api.LogicalDatastoreType store, org.opendaylight.yangtools.yang.binding.InstanceIdentifier<T> path, T data, boolean createParents)
-
readFromTransaction
public <T extends org.opendaylight.yangtools.yang.binding.DataObject> com.google.common.util.concurrent.ListenableFuture<Optional<T>> readFromTransaction(org.opendaylight.mdsal.common.api.LogicalDatastoreType store, org.opendaylight.yangtools.yang.binding.InstanceIdentifier<T> path)
-
onTransactionChainFailed
public void onTransactionChainFailed(org.opendaylight.mdsal.binding.api.TransactionChain chain, org.opendaylight.mdsal.binding.api.Transaction transaction, Throwable cause)
- Specified by:
onTransactionChainFailed
in interfaceorg.opendaylight.mdsal.binding.api.TransactionChainListener
-
onTransactionChainSuccessful
public void onTransactionChainSuccessful(org.opendaylight.mdsal.binding.api.TransactionChain chain)
- Specified by:
onTransactionChainSuccessful
in interfaceorg.opendaylight.mdsal.binding.api.TransactionChainListener
-
shuttingDown
public com.google.common.util.concurrent.FluentFuture<?> shuttingDown()
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
-
acquireWriteTransactionLock
public void acquireWriteTransactionLock()
-
releaseWriteTransactionLock
public void releaseWriteTransactionLock()
-
-