org.hibernate.engine.jdbc.spi
Interface JdbcCoordinator

All Superinterfaces:
Serializable
All Known Implementing Classes:
JdbcCoordinatorImpl

public interface JdbcCoordinator
extends Serializable

Coordinates JDBC-related activities.


Method Summary
 void abortBatch()
          Abort the currently managed batch (if any)
 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.
<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 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)
          Get a batch instance.
 LogicalConnectionImplementor getLogicalConnection()
          Retrieves the logical connection associated with this JDBC coordinator.
 StatementPreparer getStatementPreparer()
          Obtain the statement preparer associated with this JDBC coordinator.
 TransactionCoordinator getTransactionCoordinator()
          Retrieve the transaction coordinator associated with this JDBC coordinator.
 void setTransactionTimeOut(int seconds)
          Set the effective transaction timeout period for the current transaction, in seconds.
 

Method Detail

getTransactionCoordinator

TransactionCoordinator getTransactionCoordinator()
Retrieve the transaction coordinator associated with this JDBC coordinator.

Returns:
The transaction coordinator

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

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 complete flushEnding()


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 managed logical 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.


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.


setTransactionTimeOut

void setTransactionTimeOut(int seconds)
Set the effective transaction timeout period for the current transaction, in seconds.

Parameters:
seconds - The number of seconds before a time out should occur.

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.


Copyright © 2001-2012 Red Hat, Inc. All Rights Reserved.