Interface ManagedNewTransactionRunner

    • Method Detail

      • applyWithNewTransactionChainAndClose

        <R> R applyWithNewTransactionChainAndClose​(Function<ManagedTransactionChain,​R> chainConsumer)
        Invokes a function with a new ManagedTransactionChain, 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.

        Type Parameters:
        R - The type of result returned by the function.
        Parameters:
        chainConsumer - The Function that will build transactions in the transaction chain.
        Returns:
        The result of the function call.