Class RDBMSConsistentReadTransaction
java.lang.Object
com.kingsrook.qqq.backend.core.actions.QBackendTransaction
com.kingsrook.qqq.backend.module.rdbms.actions.RDBMSTransaction
com.kingsrook.qqq.backend.module.rdbms.actions.RDBMSConsistentReadTransaction
- All Implemented Interfaces:
AutoCloseable
RDBMS transaction opened by RDBMSBackendModule.openConsistentReadTransaction:
a (read-only, by default) transaction on one connection, started such that
every table read through it sees one snapshot. Pass it as the transaction on
query, count, etc. inputs.
The connection's isolation level and read-only flag are put back when this
transaction is closed (as the connection may come from a pool). Closing
without commit rolls back - which, for a read-only transaction, is the same
thing, and releases the snapshot.
-
Constructor Summary
ConstructorsConstructorDescriptionRDBMSConsistentReadTransaction(Connection connection, RDBMSActionStrategyInterface strategy, ConsistentReadInput input) Constructor - takes the snapshot (using the strategy for the database vendor), or closes the connection and throws if that fails. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close any resources associated with the transaction.What a transaction from openConsistentReadTransaction guarantees.For a transaction from openConsistentReadTransaction, the id of a snapshot that other transactions can attach to (via ConsistentReadInput .importSnapshotId) - for backends that support sharing one (e.g., postgres).Methods inherited from class com.kingsrook.qqq.backend.module.rdbms.actions.RDBMSTransaction
commit, getConnection, rollbackMethods inherited from class com.kingsrook.qqq.backend.core.actions.QBackendTransaction
addAfterCommitCallback, discardAfterCommitCallbacks, openConsistentReadFor, openFor, runAfterCommitCallbacks
-
Constructor Details
-
RDBMSConsistentReadTransaction
public RDBMSConsistentReadTransaction(Connection connection, RDBMSActionStrategyInterface strategy, ConsistentReadInput input) throws SQLException Constructor - takes the snapshot (using the strategy for the database vendor), or closes the connection and throws if that fails.- Throws:
SQLException
-
-
Method Details
-
getExportedSnapshotId
Description copied from class:QBackendTransactionFor a transaction from openConsistentReadTransaction, the id of a snapshot that other transactions can attach to (via ConsistentReadInput .importSnapshotId) - for backends that support sharing one (e.g., postgres). Empty otherwise.- Overrides:
getExportedSnapshotIdin classQBackendTransaction
-
getConsistencyGuarantee
Description copied from class:QBackendTransactionWhat a transaction from openConsistentReadTransaction guarantees. Callers should record this, rather than assume ONE_INSTANT.- Overrides:
getConsistencyGuaranteein classQBackendTransaction
-
close
public void close()Description copied from class:QBackendTransactionClose any resources associated with the transaction. In theory, should only be called after a commit or rollback was done.- Specified by:
closein interfaceAutoCloseable- Overrides:
closein classRDBMSTransaction
-