Package org.hibernate.engine.jdbc.spi
Interface JdbcCoordinator
-
- All Superinterfaces:
JdbcResourceTransactionAccess,java.io.Serializable,TransactionCoordinatorOwner
public interface JdbcCoordinator extends java.io.Serializable, TransactionCoordinatorOwner, JdbcResourceTransactionAccess
Coordinates JDBC-related activities.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description voidabortBatch()Abort the currently managed batch (if any)voidafterStatementExecution()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.voidafterTransaction()Signals the end of transaction.voidcancelLastQuery()Attempt to cancel the last query sent to the JDBC driver.java.sql.Connectionclose()Close this coordinator and release and resources.<T> TcoordinateWork(WorkExecutorVisitable<T> work)Perform the requested work handling exceptions, coordinating and handling return processing.intdetermineRemainingTransactionTimeOutPeriod()Calculate the amount of time, in seconds, still remaining before transaction timeout occurs.voiddisableReleases()Disable connection releasesvoidenableReleases()Enable connection releasesvoidexecuteBatch()Execute the currently managed batch (if any)voidflushBeginning()Callback to let us know that a flush is beginning.voidflushEnding()Callback to let us know that a flush is ending.BatchgetBatch(BatchKey key)Get a batch instance.default PhysicalConnectionHandlingModegetConnectionHandlingMode()Deprecated.(since 5.2) access viagetLogicalConnection()insteaddefault ConnectionReleaseModegetConnectionReleaseMode()Deprecated.(since 5.2) usePhysicalConnectionHandlingModeviagetLogicalConnection()insteadLogicalConnectionImplementorgetLogicalConnection()Retrieves the logical connection associated with this JDBC coordinator.default ResourceRegistrygetResourceRegistry()Deprecated.(since 5.2) access viagetLogicalConnection()insteadResultSetReturngetResultSetReturn()Obtain the resultset extractor associated with this JDBC coordinator.StatementPreparergetStatementPreparer()Obtain the statement preparer associated with this JDBC coordinator.booleanisReadyForSerialization()Can this coordinator be serialized?voidregisterLastQuery(java.sql.Statement statement)Register a query statement as being able to be cancelled.voidserialize(java.io.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
-
getBatch
Batch getBatch(BatchKey key)
Get a batch instance.- Parameters:
key- The unique batch key.- Returns:
- The batch
-
executeBatch
void executeBatch()
Execute the currently managed batch (if any)
-
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 the resultset 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
java.sql.Connection close()
Close this coordinator and release and resources.- Returns:
- The
Connectionassociated 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 until a transaction timeout occurs. A negative value indicates no timeout was requested.
- Throws:
TransactionException- Indicates the time out period has already been exceeded.
-
enableReleases
void enableReleases()
Enable connection releases
-
disableReleases
void disableReleases()
Disable connection releases
-
registerLastQuery
void registerLastQuery(java.sql.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:
trueindicates the coordinator can be serialized.
-
getConnectionReleaseMode
@Deprecated default ConnectionReleaseMode getConnectionReleaseMode()
Deprecated.(since 5.2) usePhysicalConnectionHandlingModeviagetLogicalConnection()insteadThe release mode under which this logical connection is operating.- Returns:
- the release mode.
-
getConnectionHandlingMode
@Deprecated default PhysicalConnectionHandlingMode getConnectionHandlingMode()
Deprecated.(since 5.2) access viagetLogicalConnection()insteadThe mode for physical handling of the JDBC Connection- Returns:
- The JDBC Connection handlng mode
-
getResourceRegistry
@Deprecated default ResourceRegistry getResourceRegistry()
Deprecated.(since 5.2) access viagetLogicalConnection()instead
-
serialize
void serialize(java.io.ObjectOutputStream objectOutputStream) throws java.io.IOException- Throws:
java.io.IOException
-
-