org.hibernate.engine.jdbc.internal
Class JdbcCoordinatorImpl

java.lang.Object
  extended by org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl
All Implemented Interfaces:
Serializable, JdbcCoordinator

public class JdbcCoordinatorImpl
extends Object
implements JdbcCoordinator

Standard Hibernate implementation of JdbcCoordinator

IMPL NOTE : Custom serialization handling!

See Also:
Serialized Form

Constructor Summary
JdbcCoordinatorImpl(Connection userSuppliedConnection, TransactionCoordinatorImpl transactionCoordinator)
           
 
Method Summary
 void abortBatch()
          Abort the currently managed batch (if any)
 void afterDeserialize(TransactionCoordinatorImpl transactionCoordinator)
           
 void afterTransaction()
          Signals the end of transaction.
protected  BatchBuilder batchBuilder()
           
 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.
static JdbcCoordinatorImpl deserialize(ObjectInputStream ois, TransactionContext transactionContext)
           
 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 serialize(ObjectOutputStream oos)
           
protected  SessionFactoryImplementor sessionFactory()
           
 void setTransactionTimeOut(int seconds)
          Set the effective transaction timeout period for the current transaction, in seconds.
protected  TransactionEnvironment transactionEnvironment()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JdbcCoordinatorImpl

public JdbcCoordinatorImpl(Connection userSuppliedConnection,
                           TransactionCoordinatorImpl transactionCoordinator)
Method Detail

getTransactionCoordinator

public TransactionCoordinator getTransactionCoordinator()
Description copied from interface: JdbcCoordinator
Retrieve the transaction coordinator associated with this JDBC coordinator.

Specified by:
getTransactionCoordinator in interface JdbcCoordinator
Returns:
The transaction coordinator

getLogicalConnection

public LogicalConnectionImplementor getLogicalConnection()
Description copied from interface: JdbcCoordinator
Retrieves the logical connection associated with this JDBC coordinator.

Specified by:
getLogicalConnection in interface JdbcCoordinator
Returns:
The logical connection

transactionEnvironment

protected TransactionEnvironment transactionEnvironment()

sessionFactory

protected SessionFactoryImplementor sessionFactory()

batchBuilder

protected BatchBuilder batchBuilder()

flushBeginning

public void flushBeginning()
Description copied from interface: JdbcCoordinator
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 JdbcCoordinator.flushEnding()

Specified by:
flushBeginning in interface JdbcCoordinator

flushEnding

public void flushEnding()
Description copied from interface: JdbcCoordinator
Callback to let us know that a flush is ending. We use this fact to stop circumventing aggressive releasing connections.

Specified by:
flushEnding in interface JdbcCoordinator

close

public Connection close()
Description copied from interface: JdbcCoordinator
Close this coordinator and release and resources.

Specified by:
close in interface JdbcCoordinator
Returns:
The Connection associated with the managed logical connection
See Also:
LogicalConnection.close()

getBatch

public Batch getBatch(BatchKey key)
Description copied from interface: JdbcCoordinator
Get a batch instance.

Specified by:
getBatch in interface JdbcCoordinator
Parameters:
key - The unique batch key.
Returns:
The batch

executeBatch

public void executeBatch()
Description copied from interface: JdbcCoordinator
Execute the currently managed batch (if any)

Specified by:
executeBatch in interface JdbcCoordinator

abortBatch

public void abortBatch()
Description copied from interface: JdbcCoordinator
Abort the currently managed batch (if any)

Specified by:
abortBatch in interface JdbcCoordinator

getStatementPreparer

public StatementPreparer getStatementPreparer()
Description copied from interface: JdbcCoordinator
Obtain the statement preparer associated with this JDBC coordinator.

Specified by:
getStatementPreparer in interface JdbcCoordinator
Returns:
This coordinator's statement preparer

setTransactionTimeOut

public void setTransactionTimeOut(int seconds)
Description copied from interface: JdbcCoordinator
Set the effective transaction timeout period for the current transaction, in seconds.

Specified by:
setTransactionTimeOut in interface JdbcCoordinator
Parameters:
seconds - The number of seconds before a time out should occur.

determineRemainingTransactionTimeOutPeriod

public int determineRemainingTransactionTimeOutPeriod()
Description copied from interface: JdbcCoordinator
Calculate the amount of time, in seconds, still remaining before transaction timeout occurs.

Specified by:
determineRemainingTransactionTimeOutPeriod in interface JdbcCoordinator
Returns:
The number of seconds remaining until until a transaction timeout occurs. A negative value indicates no timeout was requested.

afterTransaction

public void afterTransaction()
Description copied from interface: JdbcCoordinator
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.

Specified by:
afterTransaction in interface JdbcCoordinator

coordinateWork

public <T> T coordinateWork(WorkExecutorVisitable<T> work)
Description copied from interface: JdbcCoordinator
Perform the requested work handling exceptions, coordinating and handling return processing.

Specified by:
coordinateWork in interface JdbcCoordinator
Type Parameters:
T - The result type.
Parameters:
work - The work to be performed.
Returns:
The work result.

cancelLastQuery

public void cancelLastQuery()
Description copied from interface: JdbcCoordinator
Attempt to cancel the last query sent to the JDBC driver.

Specified by:
cancelLastQuery in interface JdbcCoordinator

serialize

public void serialize(ObjectOutputStream oos)
               throws IOException
Throws:
IOException

deserialize

public static JdbcCoordinatorImpl deserialize(ObjectInputStream ois,
                                              TransactionContext transactionContext)
                                       throws IOException,
                                              ClassNotFoundException
Throws:
IOException
ClassNotFoundException

afterDeserialize

public void afterDeserialize(TransactionCoordinatorImpl transactionCoordinator)


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