Interface TransactionHandler

All Known Implementing Classes:
BaseInfGraph.InfTransactionHandler, SimpleTransactionHandler, TransactionHandlerBase

public interface TransactionHandler
Preliminary interface for graphs supporting transactions.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    If transactions are supported and there is a transaction in progress, abort it.
    void
    If transactions are supported, begin a new transaction.
    <T> T
    calculate(Supplier<T> action)
    Execute the supplier action within a transaction.
    <T> T
    Calculate inside a transaction if transactions supported - calculate anyway if transactions not supported.
    void
    If transactions are supported and there is a transaction in progress, commit it.
    void
    execute(Runnable action)
    Execute the runnable action within a transaction.
    void
    Execute inside a transaction if transactions supported - execute anyway if transactions not supported.
    boolean
    Does this handler support transactions at all?
  • Method Details

    • transactionsSupported

      boolean transactionsSupported()
      Does this handler support transactions at all?
      Returns:
      true iff begin/abort/commit are implemented and make sense.
    • begin

      void begin()
      If transactions are supported, begin a new transaction. If transactions are not supported, or they are but this transaction is nested and nested transactions are not supported, throw an UnsupportedOperationException.
    • abort

      void abort()
      If transactions are supported and there is a transaction in progress, abort it. If transactions are not supported, or there is no transaction in progress, throw an UnsupportedOperationException.
    • commit

      void commit()
      If transactions are supported and there is a transaction in progress, commit it. If transactions are not supported, , or there is no transaction in progress, throw an UnsupportedOperationException.
    • execute

      void execute(Runnable action)
      Execute the runnable action within a transaction. If it completes normally, commit the transaction, otherwise abort the transaction.
    • executeAlways

      void executeAlways(Runnable action)
      Execute inside a transaction if transactions supported - execute anyway if transactions not supported.
    • calculate

      <T> T calculate(Supplier<T> action)
      Execute the supplier action within a transaction. If it completes normally, commit the transaction and return the result, otherwise abort the transaction.
    • calculateAlways

      <T> T calculateAlways(Supplier<T> action)
      Calculate inside a transaction if transactions supported - calculate anyway if transactions not supported.