Interface TransactionalSystemControl
- All Known Implementing Classes:
TransactionCoordinator
public interface TransactionalSystemControl
Control interface for a transactional system.
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidexecExclusive(Runnable action) Execute an action in exclusive mode.default voidexecReadOnlyDatabase(Runnable action) Execute with a read-only database.voidReturn to normal (release waiting transactions, allow new transactions).voidEnd non-exclusive mode.voidRelease any waiting potential writers.voidEnter exclusive mode; block if necessary.voidEnter non-exclusive mode; block if necessary.voidBlock write activity - let active potential writers finish while blocking new potential writers.default booleanTry to enter exclusive mode.booleantryExclusiveMode(boolean canBlock) Try to enter exclusive mode.default booleanTry to enter non-exclusive mode; return true if successful.booleantryNonExclusiveMode(boolean canBlock) Try to enter non-exclusive mode; return true if successful.
-
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
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) withfinishExclusiveMode().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) withfinishExclusiveMode().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) withfinishExclusiveMode().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 earlierstartExclusiveMode(). -
execExclusive
Execute an action in exclusive mode. This method can block.Equivalent to:
startExclusiveMode(); try { action.run(); } finally { finishExclusiveMode(); }- Parameters:
action-
-