Interface TransactionHandler

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void abort()
      If transactions are supported and there is a transaction in progress, abort it.
      void begin()
      If transactions are supported, begin a new transaction.
      <T> T calculate​(java.util.function.Supplier<T> action)
      Execute the supplier action within a transaction.
      void commit()
      If transactions are supported and there is a transaction in progress, commit it.
      void execute​(java.lang.Runnable action)
      Execute the runnable action within a transaction.
      boolean transactionsSupported()
      Does this handler support transactions at all?
    • Method Detail

      • 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​(java.lang.Runnable action)
        Execute the runnable action within a transaction. If it completes normally, commit the transaction, otherwise abort the transaction.
      • calculate

        <T> T calculate​(java.util.function.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.