Class ManagedNewTransactionRunnerImpl
- java.lang.Object
- 
- org.opendaylight.genius.infra.ManagedNewTransactionRunnerImpl
 
- 
- All Implemented Interfaces:
- ManagedNewTransactionRunner,- ManagedTransactionFactory
 
 @Beta @Deprecated(forRemoval=true) public class ManagedNewTransactionRunnerImpl extends java.lang.Object implements ManagedNewTransactionRunner Deprecated, for removal: This API element is subject to removal in a future version.UseManagedNewTransactionRunnerImplinstead.Implementation ofManagedNewTransactionRunner. This is based onManagedTransactionFactoryImplbut re-implements operations based on (read-)write transactions to cancel transactions which don't end up making any changes to the datastore.
- 
- 
Constructor SummaryConstructors Constructor Description ManagedNewTransactionRunnerImpl(org.opendaylight.mdsal.binding.api.DataBroker broker)Deprecated, for removal: This API element is subject to removal in a future version.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description <D extends Datastore,E extends java.lang.Exception,R>
 RapplyWithNewReadOnlyTransactionAndClose(java.lang.Class<D> datastoreType, org.opendaylight.infrautils.utils.function.InterruptibleCheckedFunction<TypedReadTransaction<D>,R,E> txFunction)Invokes a function with a NEWTypedReadTransaction, and ensures that that transaction is closed.<D extends Datastore,E extends java.lang.Exception,R>
 com.google.common.util.concurrent.FluentFuture<R>applyWithNewReadWriteTransactionAndSubmit(java.lang.Class<D> datastoreType, org.opendaylight.infrautils.utils.function.InterruptibleCheckedFunction<TypedReadWriteTransaction<D>,R,E> txFunction)Deprecated, for removal: This API element is subject to removal in a future version.Invokes a function with a NEWReadWriteTransaction, and then submits that transaction and returns the Future from that submission, or cancels it if an exception was thrown and returns a failed future with that exception.protected <D extends Datastore,T extends org.opendaylight.mdsal.binding.api.WriteTransaction,W,R,E extends java.lang.Exception>
 com.google.common.util.concurrent.FluentFuture<R>applyWithNewTransactionAndSubmit(java.lang.Class<D> datastoreType, java.util.function.Supplier<T> txSupplier, java.util.function.BiFunction<java.lang.Class<D>,T,W> txWrapper, org.opendaylight.infrautils.utils.function.InterruptibleCheckedFunction<W,R,E> txFunction, java.util.function.BiFunction<T,W,com.google.common.util.concurrent.FluentFuture<?>> txSubmitter)<R> RapplyWithNewTransactionChainAndClose(java.util.function.Function<ManagedTransactionChain,R> chainConsumer)Deprecated, for removal: This API element is subject to removal in a future version.Invokes a function with a newManagedTransactionChain, which is a wrapper around standard transaction chains providing managed semantics.<D extends Datastore,E extends java.lang.Exception>
 voidcallWithNewReadOnlyTransactionAndClose(java.lang.Class<D> datastoreType, org.opendaylight.infrautils.utils.function.InterruptibleCheckedConsumer<TypedReadTransaction<D>,E> txConsumer)Invokes a function with a NEWReadTransaction, and ensures that that transaction is closed.<D extends Datastore,E extends java.lang.Exception>
 com.google.common.util.concurrent.FluentFuture<java.lang.Void>callWithNewReadWriteTransactionAndSubmit(java.lang.Class<D> datastoreType, org.opendaylight.infrautils.utils.function.InterruptibleCheckedConsumer<TypedReadWriteTransaction<D>,E> txConsumer)Deprecated, for removal: This API element is subject to removal in a future version.Invokes a consumer with a NEWReadWriteTransaction, and then submits that transaction and returns the Future from that submission, or cancels it if an exception was thrown and returns a failed future with that exception.<E extends java.lang.Exception>
 com.google.common.util.concurrent.ListenableFuture<java.lang.Void>callWithNewReadWriteTransactionAndSubmit(org.opendaylight.infrautils.utils.function.InterruptibleCheckedConsumer<org.opendaylight.mdsal.binding.api.ReadWriteTransaction,E> txConsumer)Deprecated, for removal: This API element is subject to removal in a future version.Invokes a consumer with a NEWReadWriteTransaction, and then submits that transaction and returns the Future from that submission, or cancels it if an exception was thrown and returns a failed future with that exception.protected <D extends Datastore,T extends org.opendaylight.mdsal.binding.api.WriteTransaction,W,E extends java.lang.Exception>
 com.google.common.util.concurrent.FluentFuture<java.lang.Void>callWithNewTransactionAndSubmit(java.lang.Class<D> datastoreType, java.util.function.Supplier<T> txSupplier, java.util.function.BiFunction<java.lang.Class<D>,T,W> txWrapper, org.opendaylight.infrautils.utils.function.InterruptibleCheckedConsumer<W,E> txConsumer, java.util.function.BiFunction<T,W,com.google.common.util.concurrent.FluentFuture<?>> txSubmitter)<D extends Datastore,E extends java.lang.Exception>
 com.google.common.util.concurrent.FluentFuture<java.lang.Void>callWithNewWriteOnlyTransactionAndSubmit(java.lang.Class<D> datastoreType, org.opendaylight.infrautils.utils.function.InterruptibleCheckedConsumer<TypedWriteTransaction<D>,E> txConsumer)Deprecated, for removal: This API element is subject to removal in a future version.Invokes a consumer with a NEWWriteTransaction, and then submits that transaction and returns the Future from that submission, or cancels it if an exception was thrown and returns a failed future with that exception.<E extends java.lang.Exception>
 com.google.common.util.concurrent.ListenableFuture<java.lang.Void>callWithNewWriteOnlyTransactionAndSubmit(org.opendaylight.infrautils.utils.function.InterruptibleCheckedConsumer<org.opendaylight.mdsal.binding.api.WriteTransaction,E> txConsumer)Deprecated, for removal: This API element is subject to removal in a future version.Invokes a consumer with a NEWWriteTransaction, and then submits that transaction and returns the Future from that submission, or cancels it if an exception was thrown and returns a failed future with that exception.- 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface org.opendaylight.genius.infra.ManagedTransactionFactoryapplyWithNewReadOnlyTransactionAndClose, callWithNewReadOnlyTransactionAndClose
 
- 
 
- 
- 
- 
Method Detail- 
callWithNewWriteOnlyTransactionAndSubmit@CheckReturnValue public <E extends java.lang.Exception> com.google.common.util.concurrent.ListenableFuture<java.lang.Void> callWithNewWriteOnlyTransactionAndSubmit(org.opendaylight.infrautils.utils.function.InterruptibleCheckedConsumer<org.opendaylight.mdsal.binding.api.WriteTransaction,E> txConsumer) Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:ManagedNewTransactionRunnerInvokes a consumer with a NEWWriteTransaction, and then submits that transaction and returns the Future from that submission, or cancels it if an exception was thrown and returns a failed future with that exception. Thus when this method returns, that transaction is guaranteed to have been either submitted or cancelled, and will never "leak" and waste memory.The consumer should not (cannot) itself use WriteTransaction.cancel(), or (it will throw anUnsupportedOperationException).This is an asynchronous API, like DataBroker's own; when returning from this method, the operation of the Transaction may well still be ongoing in the background, or pending; calling code therefore must handle the returned future, e.g. by passing it onwards (return), or by itself adding callback listeners to it usingFutures' methods, or by transforming it into aCompletionStageand chaining on that, or at the very least simply by usingLoggingFutures.addErrorLogging(ListenableFuture, org.slf4j.Logger, String)(but better NOT by using the blockingFuture.get()on it).- Specified by:
- callWithNewWriteOnlyTransactionAndSubmitin interface- ManagedNewTransactionRunner
- Type Parameters:
- E- Exception subclass
- Parameters:
- txConsumer- the- CheckedConsumerthat needs a new write only transaction
- Returns:
- the ListenableFuturereturned by , or a failed future with an application specific exception (not from submit())
 
 - 
callWithNewWriteOnlyTransactionAndSubmit@CheckReturnValue public <D extends Datastore,E extends java.lang.Exception> com.google.common.util.concurrent.FluentFuture<java.lang.Void> callWithNewWriteOnlyTransactionAndSubmit(java.lang.Class<D> datastoreType, org.opendaylight.infrautils.utils.function.InterruptibleCheckedConsumer<TypedWriteTransaction<D>,E> txConsumer) Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:ManagedTransactionFactoryInvokes a consumer with a NEWWriteTransaction, and then submits that transaction and returns the Future from that submission, or cancels it if an exception was thrown and returns a failed future with that exception. Thus when this method returns, that transaction is guaranteed to have been either submitted or cancelled, and will never "leak" and waste memory.The consumer should not (cannot) itself use WriteTransaction.cancel(), or (it will throw anUnsupportedOperationException).The provided transaction is specific to the given logical datastore type and cannot be used for any other. This is an asynchronous API, like DataBroker's own; when returning from this method, the operation of the Transaction may well still be ongoing in the background, or pending; calling code therefore must handle the returned future, e.g. by passing it onwards (return), or by itself adding callback listeners to it usingFutures' methods, or by transforming it into aCompletionStageusing and chaining on that, or at the very least simply by usingLoggingFutures.addErrorLogging(ListenableFuture, org.slf4j.Logger, String)(but better NOT by using the blockingFuture.get()on it).- Specified by:
- callWithNewWriteOnlyTransactionAndSubmitin interface- ManagedTransactionFactory
- Type Parameters:
- D- DataObject subclass
- E- Exception subclass
- Parameters:
- datastoreType- the- Datastoretype that will be accessed
- txConsumer- the- InterruptibleCheckedConsumerthat needs a new write only transaction
- Returns:
- the ListenableFuturereturned by , or a failed future with an application specific exception (not from submit())
 
 - 
callWithNewReadWriteTransactionAndSubmit@CheckReturnValue public <E extends java.lang.Exception> com.google.common.util.concurrent.ListenableFuture<java.lang.Void> callWithNewReadWriteTransactionAndSubmit(org.opendaylight.infrautils.utils.function.InterruptibleCheckedConsumer<org.opendaylight.mdsal.binding.api.ReadWriteTransaction,E> txConsumer) Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:ManagedNewTransactionRunnerInvokes a consumer with a NEWReadWriteTransaction, and then submits that transaction and returns the Future from that submission, or cancels it if an exception was thrown and returns a failed future with that exception. Thus when this method returns, that transaction is guaranteed to have been either submitted or cancelled, and will never "leak" and waste memory.The consumer should not (cannot) itself use WriteTransaction.cancel(), or (it will throw anUnsupportedOperationException).This is an asynchronous API, like DataBroker's own; when returning from this method, the operation of the Transaction may well still be ongoing in the background, or pending; calling code therefore must handle the returned future, e.g. by passing it onwards (return), or by itself adding callback listeners to it usingFutures' methods, or by transforming it into aCompletionStageand chaining on that, or at the very least simply by usingLoggingFutures.addErrorLogging(ListenableFuture, org.slf4j.Logger, String)(but better NOT by using the blockingFuture.get()on it).- Specified by:
- callWithNewReadWriteTransactionAndSubmitin interface- ManagedNewTransactionRunner
- Type Parameters:
- E- Exception subclass
- Parameters:
- txConsumer- the- CheckedConsumerthat needs a new read-write transaction
- Returns:
- the ListenableFuturereturned by , or a failed future with an application specific exception (not from submit())
 
 - 
callWithNewReadWriteTransactionAndSubmit@CheckReturnValue public <D extends Datastore,E extends java.lang.Exception> com.google.common.util.concurrent.FluentFuture<java.lang.Void> callWithNewReadWriteTransactionAndSubmit(java.lang.Class<D> datastoreType, org.opendaylight.infrautils.utils.function.InterruptibleCheckedConsumer<TypedReadWriteTransaction<D>,E> txConsumer) Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:ManagedTransactionFactoryInvokes a consumer with a NEWReadWriteTransaction, and then submits that transaction and returns the Future from that submission, or cancels it if an exception was thrown and returns a failed future with that exception. Thus when this method returns, that transaction is guaranteed to have been either submitted or cancelled, and will never "leak" and waste memory.The consumer should not (cannot) itself use WriteTransaction.cancel(), or (it will throw anUnsupportedOperationException).The provided transaction is specific to the given logical datastore type and cannot be used for any other. This is an asynchronous API, like DataBroker's own; when returning from this method, the operation of the Transaction may well still be ongoing in the background, or pending; calling code therefore must handle the returned future, e.g. by passing it onwards (return), or by itself adding callback listeners to it usingFutures' methods, or by transforming it into aCompletionStageand chaining on that, or at the very least simply by usingLoggingFutures.addErrorLogging(ListenableFuture, org.slf4j.Logger, String)(but better NOT by using the blockingFuture.get()on it).- Specified by:
- callWithNewReadWriteTransactionAndSubmitin interface- ManagedTransactionFactory
- Type Parameters:
- D- DataObject subclass
- E- Exception subclass
- Parameters:
- datastoreType- the- Datastoretype that will be accessed
- txConsumer- the- InterruptibleCheckedConsumerthat needs a new read-write transaction
- Returns:
- the ListenableFuturereturned by , or a failed future with an application specific exception (not from submit())
 
 - 
applyWithNewReadWriteTransactionAndSubmit@CheckReturnValue public <D extends Datastore,E extends java.lang.Exception,R> com.google.common.util.concurrent.FluentFuture<R> applyWithNewReadWriteTransactionAndSubmit(java.lang.Class<D> datastoreType, org.opendaylight.infrautils.utils.function.InterruptibleCheckedFunction<TypedReadWriteTransaction<D>,R,E> txFunction) Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:ManagedTransactionFactoryInvokes a function with a NEWReadWriteTransaction, and then submits that transaction and returns the Future from that submission, or cancels it if an exception was thrown and returns a failed future with that exception. Thus when this method returns, that transaction is guaranteed to have been either submitted or cancelled, and will never "leak" and waste memory.The function must not itself use WriteTransaction.cancel(), or (it will throw anUnsupportedOperationException).The provided transaction is specific to the given logical datastore type and cannot be used for any other. This is an asynchronous API, like DataBroker's own; when returning from this method, the operation of the Transaction may well still be ongoing in the background, or pending; calling code therefore must handle the returned future, e.g. by passing it onwards (return), or by itself adding callback listeners to it usingFutures' methods, or by transforming it into aCompletionStageand chaining on that, or at the very least simply by usingLoggingFutures.addErrorLogging(ListenableFuture, org.slf4j.Logger, String)(but better NOT by using the blockingFuture.get()on it).- Specified by:
- applyWithNewReadWriteTransactionAndSubmitin interface- ManagedTransactionFactory
- Type Parameters:
- D- DataObject subclass
- E- Exception subclass
- R- The type of result returned by the function.
- Parameters:
- datastoreType- the- Datastoretype that will be accessed
- txFunction- the- InterruptibleCheckedFunctionthat needs a new read-write transaction
- Returns:
- the ListenableFuturereturned by , or a failed future with an application specific exception (not from submit())
 
 - 
applyWithNewTransactionChainAndClosepublic <R> R applyWithNewTransactionChainAndClose(java.util.function.Function<ManagedTransactionChain,R> chainConsumer) Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:ManagedNewTransactionRunnerInvokes a function with a newManagedTransactionChain, which is a wrapper around standard transaction chains providing managed semantics. The transaction chain will be closed when the function returns.This is an asynchronous API, like DataBroker's own; when this method returns, the transactions in the chain may well still be ongoing in the background, or pending. It is up to the consumer and caller to agree on how failure will be handled; for example, the return type can include the futures corresponding to the transactions in the chain. The implementation uses a default transaction chain listener which logs an error if any of the transactions fail.The MD-SAL transaction chain semantics are preserved: each transaction in the chain will see the results of the previous transactions in the chain, even if they haven't been fully committed yet; and any error will result in subsequent transactions in the chain not being submitted. - Specified by:
- applyWithNewTransactionChainAndClosein interface- ManagedNewTransactionRunner
- Type Parameters:
- R- The type of result returned by the function.
- Parameters:
- chainConsumer- The- InterruptibleCheckedFunctionthat will build transactions in the transaction chain.
- Returns:
- The result of the function call.
 
 - 
applyWithNewReadOnlyTransactionAndClosepublic <D extends Datastore,E extends java.lang.Exception,R> R applyWithNewReadOnlyTransactionAndClose(java.lang.Class<D> datastoreType, org.opendaylight.infrautils.utils.function.InterruptibleCheckedFunction<TypedReadTransaction<D>,R,E> txFunction) throws E extends java.lang.Exception, java.lang.InterruptedException Description copied from interface:ManagedTransactionFactoryInvokes a function with a NEWTypedReadTransaction, and ensures that that transaction is closed. Thus when this method returns, that transaction is guaranteed to have been closed, and will never "leak" and waste memory.The function must not itself attempt to close the transaction. (It can't directly, since TypedReadTransactiondoesn't expose aclose()method.)The provided transaction is specific to the given logical datastore type and cannot be used for any other. - Specified by:
- applyWithNewReadOnlyTransactionAndClosein interface- ManagedTransactionFactory
- Type Parameters:
- D- DataObject subclass
- E- Exception subclass
- R- The type of result returned by the function.
- Parameters:
- datastoreType- the- Datastoretype that will be accessed
- txFunction- the- InterruptibleCheckedFunctionthat needs a new read transaction
- Returns:
- the result of the function.
- Throws:
- E- if an error occurs.
- java.lang.InterruptedException- if the transaction is interrupted.
- E extends java.lang.Exception
 
 - 
callWithNewReadOnlyTransactionAndClosepublic <D extends Datastore,E extends java.lang.Exception> void callWithNewReadOnlyTransactionAndClose(java.lang.Class<D> datastoreType, org.opendaylight.infrautils.utils.function.InterruptibleCheckedConsumer<TypedReadTransaction<D>,E> txConsumer) throws E extends java.lang.Exception, java.lang.InterruptedException Description copied from interface:ManagedTransactionFactoryInvokes a function with a NEWReadTransaction, and ensures that that transaction is closed. Thus when this method returns, that transaction is guaranteed to have been closed, and will never "leak" and waste memory.The function must not itself attempt to close the transaction. (It can't directly, since ReadTransactiondoesn't expose aclose()method.)The provided transaction is specific to the given logical datastore type and cannot be used for any other. - Specified by:
- callWithNewReadOnlyTransactionAndClosein interface- ManagedTransactionFactory
- Type Parameters:
- D- DataObject subclass
- E- Exception subclass
- Parameters:
- datastoreType- the- Datastoretype that will be accessed
- txConsumer- the- InterruptibleCheckedFunctionthat needs a new read transaction
- Throws:
- E- if an error occurs.
- java.lang.InterruptedException- if the transaction is interrupted.
- E extends java.lang.Exception
 
 - 
callWithNewTransactionAndSubmit@CheckReturnValue protected <D extends Datastore,T extends org.opendaylight.mdsal.binding.api.WriteTransaction,W,E extends java.lang.Exception> com.google.common.util.concurrent.FluentFuture<java.lang.Void> callWithNewTransactionAndSubmit(java.lang.Class<D> datastoreType, java.util.function.Supplier<T> txSupplier, java.util.function.BiFunction<java.lang.Class<D>,T,W> txWrapper, org.opendaylight.infrautils.utils.function.InterruptibleCheckedConsumer<W,E> txConsumer, java.util.function.BiFunction<T,W,com.google.common.util.concurrent.FluentFuture<?>> txSubmitter) 
 - 
applyWithNewTransactionAndSubmit@CheckReturnValue protected <D extends Datastore,T extends org.opendaylight.mdsal.binding.api.WriteTransaction,W,R,E extends java.lang.Exception> com.google.common.util.concurrent.FluentFuture<R> applyWithNewTransactionAndSubmit(java.lang.Class<D> datastoreType, java.util.function.Supplier<T> txSupplier, java.util.function.BiFunction<java.lang.Class<D>,T,W> txWrapper, org.opendaylight.infrautils.utils.function.InterruptibleCheckedFunction<W,R,E> txFunction, java.util.function.BiFunction<T,W,com.google.common.util.concurrent.FluentFuture<?>> txSubmitter) 
 
- 
 
-