Package org.hibernate.engine.jdbc.spi
Interface JdbcCoordinator
-
- All Superinterfaces:
JdbcResourceTransactionAccess
,Serializable
,TransactionCoordinatorOwner
- All Known Implementing Classes:
JdbcCoordinatorImpl
public interface JdbcCoordinator extends Serializable, TransactionCoordinatorOwner, JdbcResourceTransactionAccess
Coordinates JDBC-related activities.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
abortBatch()
Abort the currently managed batch (if any)void
afterStatementExecution()
Used to signify that a statement has completed execution which may indicate that this logical connection need to perform an aggressive release of its physical connection.void
afterTransaction()
Signals the end of transaction.void
cancelLastQuery()
Attempt to cancel the last query sent to the JDBC driver.Connection
close()
Close this coordinator and release and resources.void
conditionallyExecuteBatch(BatchKey key)
Conditionally execute the currently managed batch (if any), if the keys do not match<T> T
coordinateWork(WorkExecutorVisitable<T> work)
Perform the requested work handling exceptions, coordinating and handling return processing.int
determineRemainingTransactionTimeOutPeriod()
Calculate the amount of time, in seconds, still remaining before transaction timeout occurs.void
disableReleases()
Disable connection releasesvoid
enableReleases()
Enable connection releasesvoid
executeBatch()
Execute the currently managed batch (if any)void
flushBeginning()
Callback to let us know that a flush is beginning.void
flushEnding()
Callback to let us know that a flush is ending.Batch
getBatch(BatchKey key, Integer batchSize, Supplier<PreparedStatementGroup> statementGroupSupplier)
Get the batch for the supplied key, creating one if needed using the supplied statementGroupSupplier.LogicalConnectionImplementor
getLogicalConnection()
Retrieves the logical connection associated with this JDBC coordinator.MutationStatementPreparer
getMutationStatementPreparer()
The builder of prepared and callable JDBC statements for mutation operations (insert, update and delete) originating from persistent context events, as opposed to Query handlingResultSetReturn
getResultSetReturn()
Obtain theResultSet
extractor associated with this JDBC coordinator.StatementPreparer
getStatementPreparer()
Obtain the statement preparer associated with this JDBC coordinator.boolean
isReadyForSerialization()
Can this coordinator be serialized?void
registerLastQuery(Statement statement)
Register a query statement as being able to be cancelled.void
serialize(ObjectOutputStream objectOutputStream)
-
Methods inherited from interface org.hibernate.resource.transaction.backend.jdbc.spi.JdbcResourceTransactionAccess
getResourceLocalTransaction
-
Methods inherited from interface org.hibernate.resource.transaction.spi.TransactionCoordinatorOwner
afterTransactionBegin, afterTransactionCompletion, beforeTransactionCompletion, flushBeforeTransactionCompletion, getJdbcSessionOwner, isActive, setTransactionTimeOut, startTransactionBoundary
-
-
-
-
Method Detail
-
getLogicalConnection
LogicalConnectionImplementor getLogicalConnection()
Retrieves the logical connection associated with this JDBC coordinator.- Returns:
- The logical connection
-
getMutationStatementPreparer
MutationStatementPreparer getMutationStatementPreparer()
The builder of prepared and callable JDBC statements for mutation operations (insert, update and delete) originating from persistent context events, as opposed to Query handling
-
getBatch
Batch getBatch(BatchKey key, Integer batchSize, Supplier<PreparedStatementGroup> statementGroupSupplier)
Get the batch for the supplied key, creating one if needed using the supplied statementGroupSupplier.- Implementation Note:
- Any previous Batch is executed and released prior to returning
-
executeBatch
void executeBatch()
Execute the currently managed batch (if any)
-
conditionallyExecuteBatch
void conditionallyExecuteBatch(BatchKey key)
Conditionally execute the currently managed batch (if any), if the keys do not match
-
abortBatch
void abortBatch()
Abort the currently managed batch (if any)
-
getStatementPreparer
StatementPreparer getStatementPreparer()
Obtain the statement preparer associated with this JDBC coordinator.- Returns:
- This coordinator's statement preparer
-
getResultSetReturn
ResultSetReturn getResultSetReturn()
Obtain theResultSet
extractor associated with this JDBC coordinator.- Returns:
- This coordinator's resultset extractor
-
flushBeginning
void flushBeginning()
Callback to let us know that a flush is beginning. We use this fact to temporarily circumvent aggressive connection releasing until after the flush cycle is completeflushEnding()
-
flushEnding
void flushEnding()
Callback to let us know that a flush is ending. We use this fact to stop circumventing aggressive releasing connections.
-
close
Connection close()
Close this coordinator and release and resources.- Returns:
- The
Connection
associated with the managedlogical connection
- See Also:
LogicalConnection.close()
-
afterTransaction
void afterTransaction()
Signals the end of transaction.Intended for use from the transaction coordinator, after local transaction completion. Used to conditionally release the JDBC connection aggressively if the configured release mode indicates.
-
afterStatementExecution
void afterStatementExecution()
Used to signify that a statement has completed execution which may indicate that this logical connection need to perform an aggressive release of its physical connection.
-
coordinateWork
<T> T coordinateWork(WorkExecutorVisitable<T> work)
Perform the requested work handling exceptions, coordinating and handling return processing.- Type Parameters:
T
- The result type.- Parameters:
work
- The work to be performed.- Returns:
- The work result.
-
cancelLastQuery
void cancelLastQuery()
Attempt to cancel the last query sent to the JDBC driver.
-
determineRemainingTransactionTimeOutPeriod
int determineRemainingTransactionTimeOutPeriod()
Calculate the amount of time, in seconds, still remaining before transaction timeout occurs.- Returns:
- The number of seconds remaining until a transaction timeout occurs. A negative value indicates no timeout was requested.
- Throws:
TransactionException
- Indicates the timeout period has already been exceeded.
-
enableReleases
void enableReleases()
Enable connection releases
-
disableReleases
void disableReleases()
Disable connection releases
-
registerLastQuery
void registerLastQuery(Statement statement)
Register a query statement as being able to be cancelled.- Parameters:
statement
- The cancel-able query statement.
-
isReadyForSerialization
boolean isReadyForSerialization()
Can this coordinator be serialized?- Returns:
true
indicates the coordinator can be serialized.
-
serialize
void serialize(ObjectOutputStream objectOutputStream) throws IOException
- Throws:
IOException
-
-