XPooledConnection (Transactions JTA 4.0.6 API)
Date: 2018-01-11

com.atomikos.datasource.pool

## Interface XPooledConnection

- All Known Implementing Classes:
    AbstractXPooledConnection

      public interface XPooledConnection

  A pooling-capable object wrapping a physical connection to an underlying resource.

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `canBeRecycledForCallingThread()` Can the connection be recycled (if not available) for the calling thread?
    `Reapable` | `createConnectionProxy()` Create a disposable connection object that acts a controller for the pooled connection.
    `void` | `destroy()` Destroy the pooled connection by closing the underlying physical connection.
    `long` | `getCreationTime()` Get the moment when the connection was created.
    `long` | `getLastTimeAcquired()` Get the last time the connection was acquired.
    `long` | `getLastTimeReleased()` Get the last time the connection was released, i.e.
    `boolean` | `isAvailable()` Is the connection available to be taken out of the pool ?
    `boolean` | `isErroneous()` Is the pooled connection broken ?
    `boolean` | `markAsBeingAcquiredIfAvailable()` Attempt to claim this connection for use.
    `void` | `reap()` Invalidates (i.e., forces close) of the current connection proxy This does not mean that the connection can be reused immediately: pending transactions may exist that need to terminate.
    `void` | `registerXPooledConnectionEventListener(XPooledConnectionEventListener listener)`
    `void` | `unregisterXPooledConnectionEventListener(XPooledConnectionEventListener listener)`

- - ### Method Detail

    - #### isAvailable

          boolean isAvailable()

      Is the connection available to be taken out of the pool ?
      Returns:

    - #### canBeRecycledForCallingThread

          boolean canBeRecycledForCallingThread()

      Can the connection be recycled (if not available) for the calling thread?
      Returns:

    - #### destroy

          void destroy()

      Destroy the pooled connection by closing the underlying physical connection.

    - #### reap

          void reap()

      Invalidates (i.e., forces close) of the current connection proxy This does not mean that the connection can be reused immediately: pending transactions may exist that need to terminate. In other words: this acts as a forced close on the proxy.

    - #### getLastTimeAcquired

          long getLastTimeAcquired()

      Get the last time the connection was acquired.
      Returns:

    - #### getLastTimeReleased

          long getLastTimeReleased()

      Get the last time the connection was released, i.e. the last time when it has become available.
      Returns:

    - #### createConnectionProxy

          Reapable createConnectionProxy()
                                         throws CreateConnectionException

      Create a disposable connection object that acts a controller for the pooled connection. What exactly a connection object is depends on the implementation. Calling this method will also clear any flags set by markAsBeingAcquiredIfAvailable.
      Returns:
      Throws:
        `CreateConnectionException`

    - #### isErroneous

          boolean isErroneous()

      Is the pooled connection broken ?
      Returns:

    - #### getCreationTime

          long getCreationTime()

      Get the moment when the connection was created.
      Returns:

    - #### registerXPooledConnectionEventListener

          void registerXPooledConnectionEventListener(XPooledConnectionEventListener listener)

    - #### unregisterXPooledConnectionEventListener

          void unregisterXPooledConnectionEventListener(XPooledConnectionEventListener listener)

    - #### markAsBeingAcquiredIfAvailable

          boolean markAsBeingAcquiredIfAvailable()

      Attempt to claim this connection for use.
      Returns:
        True if the connection is available, and could be claimed for the caller of this method. In that case, it is up to the caller to call createConnectionProxy at a later time (which will in turn trigger a round-trip to the resource if there is any testQuery set) or the pool will be leaking.

Copyright © 2018. All Rights Reserved.