JdbcPooledConnection (Bitronix Transaction Manager :: Core 2.1.4 API)
Date: 2013-09-15

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## bitronix.tm.resource.jdbc
Class JdbcPooledConnection

    java.lang.Object
      bitronix.tm.resource.common.AbstractXAStatefulHolder
          bitronix.tm.resource.common.AbstractXAResourceHolder
              bitronix.tm.resource.jdbc.JdbcPooledConnection

All Implemented Interfaces:
  StateChangeListener, XAResourceHolder, XAStatefulHolder, JdbcPooledConnectionMBean

    public class JdbcPooledConnection

extends AbstractXAResourceHolder
implements StateChangeListener, JdbcPooledConnectionMBean

Implementation of a JDBC pooled connection wrapping vendor's `XAConnection` implementation.

Author:
  lorban, brettw

Field Summary

Fields inherited from interface bitronix.tm.resource.common.XAStatefulHolder
`STATE_ACCESSIBLE, STATE_CLOSED, STATE_IN_POOL, STATE_NOT_ACCESSIBLE`

Constructor Summary
`JdbcPooledConnection(PoolingDataSource poolingDataSource, XAConnection xaConnection)`

Method Summary
`void` | `close()` Close the physical connection that this `XAStatefulHolder` represents.
`RecoveryXAResourceHolder` | `createRecoveryXAResourceHolder()`
`Date` | `getAcquisitionDate()`
`protected JdbcPreparedStatementHandle` | `getCachedStatement(JdbcPreparedStatementHandle stmt)` Get a PreparedStatement from cache.
`Object` | `getConnectionHandle()` Create a disposable handler used to drive a pooled instance of `XAStatefulHolder`.
`Date` | `getLastReleaseDate()` Get the date at which this object was last released to the pool.
`PoolingDataSource` | `getPoolingDataSource()`
`ResourceBean` | `getResourceBean()` Get the ResourceBean which created this XAResourceHolder.
`String` | `getStateDescription()`
`Collection` | `getTransactionGtridsCurrentlyHoldingThis()`
`XAResource` | `getXAResource()` Get the vendor's `XAResource` implementation of the wrapped resource.
`List<XAResourceHolder>` | `getXAResourceHolders()` Get the list of `XAResourceHolder`s created by this `XAStatefulHolder` that are still open.
`protected JdbcPreparedStatementHandle` | `putCachedStatement(JdbcPreparedStatementHandle stmt)` Put a PreparedStatement in the cache.
`protected Statement` | `registerUncachedStatement(Statement stmt)` Register uncached statement so that it can be closed when the connection is put back in the pool.
`protected void` | `release()`
`void` | `stateChanged(XAStatefulHolder source, int oldState, int newState)` Fired when the internal state of a `XAStatefulHolder` has changed.
`void` | `stateChanging(XAStatefulHolder source, int currentState, int futureState)` Fired before the internal state of a `XAStatefulHolder` has changed.
`String` | `toString()`
`protected void` | `unregisterUncachedStatement(Statement stmt)`

Methods inherited from class bitronix.tm.resource.common.AbstractXAResourceHolder
`getXAResourceHolderStateGtrids, getXAResourceHolderStatesForGtrid, hasStateForXAResource, isParticipatingInActiveGlobalTransaction, putXAResourceHolderState, removeXAResourceHolderState`

Methods inherited from class bitronix.tm.resource.common.AbstractXAStatefulHolder
`addStateChangeEventListener, getState, removeStateChangeEventListener, setState`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface bitronix.tm.resource.common.XAStatefulHolder
`addStateChangeEventListener, getState, removeStateChangeEventListener, setState`

Constructor Detail

### JdbcPooledConnection

    public JdbcPooledConnection(PoolingDataSource poolingDataSource,
                                XAConnection xaConnection)
                         throws SQLException

Throws:
  `SQLException`

Method Detail

### close

    public void close()
               throws SQLException

  Description copied from interface: `XAStatefulHolder`
  Close the physical connection that this `XAStatefulHolder` represents.

  Specified by:
    `close` in interface `XAStatefulHolder`
  Throws:
    `SQLException`

### createRecoveryXAResourceHolder

    public RecoveryXAResourceHolder createRecoveryXAResourceHolder()

### release

    protected void release()
                    throws SQLException

  Throws:
    `SQLException`

### getXAResource

    public XAResource getXAResource()

  Description copied from interface: `XAResourceHolder`
  Get the vendor's `XAResource` implementation of the wrapped resource.

  Specified by:
    `getXAResource` in interface `XAResourceHolder`
  Returns:
    the vendor's XAResource implementation.

### getResourceBean

    public ResourceBean getResourceBean()

  Description copied from interface: `XAResourceHolder`
  Get the ResourceBean which created this XAResourceHolder.

  Specified by:
    `getResourceBean` in interface `XAResourceHolder`
  Returns:
    the ResourceBean which created this XAResourceHolder.

### getPoolingDataSource

    public PoolingDataSource getPoolingDataSource()

### getXAResourceHolders

    public List<XAResourceHolder> getXAResourceHolders()

  Description copied from interface: `XAStatefulHolder`
  Get the list of `XAResourceHolder`s created by this `XAStatefulHolder` that are still open.

  This method is thread-safe.

  Specified by:
    `getXAResourceHolders` in interface `XAStatefulHolder`
  Returns:
    the list of `XAResourceHolder`s created by this `XAStatefulHolder` that are still open.

### getConnectionHandle

    public Object getConnectionHandle()
                               throws Exception

  Description copied from interface: `XAStatefulHolder`
  Create a disposable handler used to drive a pooled instance of `XAStatefulHolder`.

  This method is thread-safe.

  Specified by:
    `getConnectionHandle` in interface `XAStatefulHolder`
  Returns:
    a resource-specific disaposable connection object.
  Throws:
    `Exception` - a resource-specific exception thrown when the disaposable connection cannot be created.

### stateChanged

    public void stateChanged(XAStatefulHolder source,
                             int oldState,
                             int newState)

  Description copied from interface: `StateChangeListener`
  Fired when the internal state of a `XAStatefulHolder` has changed.

  Specified by:
    `stateChanged` in interface `StateChangeListener`
  Parameters:
    `source` - the `XAStatefulHolder` changing state.
    `oldState` - the old state of the `XAStatefulHolder`.
    `newState` - the new state of the `XAStatefulHolder`.

### stateChanging

    public void stateChanging(XAStatefulHolder source,
                              int currentState,
                              int futureState)

  Description copied from interface: `StateChangeListener`
  Fired before the internal state of a `XAStatefulHolder` has changed.

  Specified by:
    `stateChanging` in interface `StateChangeListener`
  Parameters:
    `source` - the `XAStatefulHolder` changing state.
    `currentState` - the current state of the `XAStatefulHolder`.
    `futureState` - the future state of the `XAStatefulHolder`.

### getCachedStatement

    protected JdbcPreparedStatementHandle getCachedStatement(JdbcPreparedStatementHandle stmt)

  Get a PreparedStatement from cache.

  Parameters:
    `stmt` - the key that has been used to cache the statement.
  Returns:
    the cached statement corresponding to the key or null if no statement is cached under that key.

### putCachedStatement

    protected JdbcPreparedStatementHandle putCachedStatement(JdbcPreparedStatementHandle stmt)

  Put a PreparedStatement in the cache.

  Parameters:
    `stmt` - the statement to cache.
  Returns:
    the cached statement.

### registerUncachedStatement

    protected Statement registerUncachedStatement(Statement stmt)

  Register uncached statement so that it can be closed when the connection is put back in the pool.

  Parameters:
    `stmt` - the statement to register.
  Returns:
    the registered statement.

### unregisterUncachedStatement

    protected void unregisterUncachedStatement(Statement stmt)

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

### getStateDescription

    public String getStateDescription()

  Specified by:
    `getStateDescription` in interface `JdbcPooledConnectionMBean`

### getAcquisitionDate

    public Date getAcquisitionDate()

  Specified by:
    `getAcquisitionDate` in interface `JdbcPooledConnectionMBean`

### getLastReleaseDate

    public Date getLastReleaseDate()

  Description copied from interface: `XAStatefulHolder`
  Get the date at which this object was last released to the pool. This is required to check if it is eligible for discard when the containing pool needs to shrink.

  Specified by:
    `getLastReleaseDate` in interface `XAStatefulHolder`
  Returns:
    the date at which this object was last released to the pool or null if it never left the pool.

### getTransactionGtridsCurrentlyHoldingThis

    public Collection getTransactionGtridsCurrentlyHoldingThis()

  Specified by:
    `getTransactionGtridsCurrentlyHoldingThis` in interface `JdbcPooledConnectionMBean`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2006-2013 Bitronix Software. All Rights Reserved.