Class 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

      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 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 close()  
      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.
      boolean initialSubmitWriteTransaction()  
      <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 releaseWriteTransactionLock()  
      com.google.common.util.concurrent.ListenableFuture<?> 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>
      void
      writeToTransaction​(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 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.ListenableFuture<?> shuttingDown()
      • acquireWriteTransactionLock

        public void acquireWriteTransactionLock()
      • releaseWriteTransactionLock

        public void releaseWriteTransactionLock()