com.atomikos.jdbc
Interface DTPPooledConnection

All Superinterfaces:
PooledConnection, XPooledConnection
All Known Implementing Classes:
ExclusiveExternalXAPooledConnectionImp, ExternalXAPooledConnectionImp

public interface DTPPooledConnection
extends XPooledConnection

A pooled connection that is distributed transaction aware. Instances are needed for DTPConnectionPool pools. Note: clients should be aware that some instances of this interface generate TWO related close events: the first when the application closes the SQL connection, and the second after two-phase commit is done. In any case, the connection can NOT be reused before isDiscarded returns true.


Method Summary
 Connection getConnection(HeuristicMessage msg)
          Get a connection with a given heuristic message.
 TransactionalResource getTransactionalResource()
          Get the transactional resource for this connection.
 boolean isDiscarded()
          Tests if the connection can be put back into the pool.
 boolean isInResourceTransaction()
          Test if the connection is currently associated with a resource transaction.
 void setResourceTransaction(ResourceTransaction restx)
          Associate a resource transaction with this connection.
 ResourceTransaction unsetResourceTransaction()
          Unsets the resource transaction property for this connection.
 
Methods inherited from interface com.atomikos.jdbc.XPooledConnection
close, getConnection, getInvalidated, getLastUse, setInvalidated, setLastUse, toString
 
Methods inherited from interface javax.sql.PooledConnection
addConnectionEventListener, removeConnectionEventListener
 

Method Detail

getConnection

Connection getConnection(HeuristicMessage msg)
                         throws SQLException
Get a connection with a given heuristic message.

Parameters:
msg - The message to include in the tx logs.
Returns:
Connection The connection to use.
Throws:
SQLException

getTransactionalResource

TransactionalResource getTransactionalResource()
Get the transactional resource for this connection.

Returns:
TransactionalResource The resource to which this connection belongs.

unsetResourceTransaction

ResourceTransaction unsetResourceTransaction()
Unsets the resource transaction property for this connection. Called to dissociate the connection with a resourcetransaction.

Returns:
ResourceTransaction The resource transaction associated with the connection, or null if none.

setResourceTransaction

void setResourceTransaction(ResourceTransaction restx)
                            throws SQLException
Associate a resource transaction with this connection. After returning, the resource transaction should be ready for resume() calls.

Parameters:
restx - The resource transaction to be associated with this connection.
Throws:
SQLException - If a SQL error occurs.

isDiscarded

boolean isDiscarded()
Tests if the connection can be put back into the pool. Some implementations of reusable connections may not be fully compliant, in that an application-level close() does not automatically imply that the connection can be reused. This function tests if the connection can be reused.

Returns:
boolean True iff the connection will NOT be used again by the current client. As a consequence, it can be put back into the pool or replaced, whichever the pool instance prefers.

isInResourceTransaction

boolean isInResourceTransaction()
Test if the connection is currently associated with a resource transaction.

Returns:
boolean True iff in a transaction.


Copyright © 2011. All Rights Reserved.