Interface TransactionalSystemControl

All Known Implementing Classes:
TransactionCoordinator

public interface TransactionalSystemControl
Control interface for a transactional system.
  • Method Details

    • startReadOnlyDatabase

      void startReadOnlyDatabase()
      Block write activity - let active potential writers finish while blocking new potential writers. On exit, there are no active writers or promote transactions. (Promotes would otherwise become write mode in their lifetime.)
    • finishReadOnlyDatabase

      void finishReadOnlyDatabase()
      Release any waiting potential writers.
    • execReadOnlyDatabase

      default void execReadOnlyDatabase(Runnable action)
      Execute with a read-only database.
    • startNonExclusiveMode

      void startNonExclusiveMode()
      Enter non-exclusive mode; block if necessary.
    • tryNonExclusiveMode

      default boolean tryNonExclusiveMode()
      Try to enter non-exclusive mode; return true if successful.
    • tryNonExclusiveMode

      boolean tryNonExclusiveMode(boolean canBlock)
      Try to enter non-exclusive mode; return true if successful.
    • finishNonExclusiveMode

      void finishNonExclusiveMode()
      End non-exclusive mode.
    • startExclusiveMode

      void startExclusiveMode()
      Enter exclusive mode; block if necessary. There are no active transactions on return; new transactions will be held up in 'begin'. Return to normal (release waiting transactions, allow new transactions) with finishExclusiveMode().

      Do not call inside an existing transaction.

    • tryExclusiveMode

      default boolean tryExclusiveMode()
      Try to enter exclusive mode. If return is true, then there are no active transactions on return and new transactions will be held up in 'begin'. If false, there were in-progress transactions. Return to normal (release waiting transactions, allow new transactions) with finishExclusiveMode().

      Do not call inside an existing transaction.

    • tryExclusiveMode

      boolean tryExclusiveMode(boolean canBlock)
      Try to enter exclusive mode. If return is true, then there are no active transactions on return and new transactions will be held up in 'begin'. If false, there were in-progress transactions. Return to normal (release waiting transactions, allow new transactions) with finishExclusiveMode().

      Do not call inside an existing transaction.

      Parameters:
      canBlock - Allow the operation block and wait for the exclusive mode lock.
    • finishExclusiveMode

      void finishExclusiveMode()
      Return to normal (release waiting transactions, allow new transactions). Must be paired with an earlier startExclusiveMode().
    • execExclusive

      default void execExclusive(Runnable action)
      Execute an action in exclusive mode. This method can block.

      Equivalent to:

         startExclusiveMode();
         try { action.run(); }
         finally { finishExclusiveMode(); }
       
      Parameters:
      action -