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 controlling WriteTransaction life cycle. It is a TransactionChainListener and provide package protected methods for writeToTransaction method (wrapped WriteOperations.put(LogicalDatastoreType, InstanceIdentifier, DataObject)) and submitTransaction method (wrapped WriteTransaction.commit()).
  • Constructor Summary

    Constructors
    Constructor
    Description
    TransactionChainManager(@NonNull org.opendaylight.mdsal.binding.api.DataBroker dataBroker, @NonNull String deviceIdentifier)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    void
    Method change status for TxChainManager to WORKING and it has to make registration for this class instance as TransactionChainListener to provide possibility a make DS transactions.
    <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)
     
    void
     
    com.google.common.util.concurrent.FluentFuture<?>
    Method change status for TxChainManger to SLEEPING and it unregisters this class instance as TransactionChainListener so it broke a possibility to write something to DS.
    boolean
     
    <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)
     
    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
     
    com.google.common.util.concurrent.FluentFuture<?>
     
    @org.checkerframework.checker.lock.qual.GuardedBy({"txLock"}) boolean
     
    @org.checkerframework.checker.lock.qual.GuardedBy({"txLock"}) boolean
    submitTransaction(boolean doSync)
     
    <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)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • TransactionChainManager

      public TransactionChainManager(@NonNull org.opendaylight.mdsal.binding.api.DataBroker dataBroker, @NonNull String deviceIdentifier)
  • Method Details

    • 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 as TransactionChainListener 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 as TransactionChainListener 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 interface org.opendaylight.mdsal.binding.api.TransactionChainListener
    • onTransactionChainSuccessful

      public void onTransactionChainSuccessful(org.opendaylight.mdsal.binding.api.TransactionChain chain)
      Specified by:
      onTransactionChainSuccessful in interface org.opendaylight.mdsal.binding.api.TransactionChainListener
    • shuttingDown

      public com.google.common.util.concurrent.FluentFuture<?> shuttingDown()
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
    • acquireWriteTransactionLock

      public void acquireWriteTransactionLock()
    • releaseWriteTransactionLock

      public void releaseWriteTransactionLock()