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

com.atomikos.datasource.pool

## Class AbstractXPooledConnection

- java.lang.Object
- - com.atomikos.datasource.pool.AbstractXPooledConnection

- All Implemented Interfaces:
    XPooledConnection

      public abstract class AbstractXPooledConnection
      extends java.lang.Object
      implements XPooledConnection

  Abstract superclass with generic support for XPooledConnection.

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `AbstractXPooledConnection(ConnectionPoolProperties props)`

  - ### 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.
    `protected abstract Reapable` | `doCreateConnectionProxy()`
    `protected void` | `fireOnXPooledConnectionTerminated()`
    `long` | `getCreationTime()` Get the moment when the connection was created.
    `protected Reapable` | `getCurrentConnectionProxy()`
    `protected int` | `getDefaultIsolationLevel()`
    `long` | `getLastTimeAcquired()` Get the last time the connection was acquired.
    `long` | `getLastTimeReleased()` Get the last time the connection was released, i.e.
    `protected java.lang.String` | `getTestQuery()`
    `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)`
    `protected abstract void` | `testUnderlyingConnection()`
    `void` | `unregisterXPooledConnectionEventListener(XPooledConnectionEventListener listener)`
    `protected void` | `updateLastTimeReleased()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface com.atomikos.datasource.pool.XPooledConnection

      `destroy, isAvailable, isErroneous`

- - ### Constructor Detail

    - #### AbstractXPooledConnection

          protected AbstractXPooledConnection(ConnectionPoolProperties props)

  - ### Method Detail

    - #### getLastTimeAcquired

          public long getLastTimeAcquired()

      Description copied from interface: `XPooledConnection`
      Get the last time the connection was acquired.
      Specified by:
        `getLastTimeAcquired` in interface `XPooledConnection`
      Returns:

    - #### getLastTimeReleased

          public long getLastTimeReleased()

      Description copied from interface: `XPooledConnection`
      Get the last time the connection was released, i.e. the last time when it has become available.
      Specified by:
        `getLastTimeReleased` in interface `XPooledConnection`
      Returns:

    - #### createConnectionProxy

          public Reapable createConnectionProxy()
                                         throws CreateConnectionException

      Description copied from interface: `XPooledConnection`
      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.
      Specified by:
        `createConnectionProxy` in interface `XPooledConnection`
      Returns:
      Throws:
        `CreateConnectionException`

    - #### reap

          public void reap()

      Description copied from interface: `XPooledConnection`
      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.
      Specified by:
        `reap` in interface `XPooledConnection`

    - #### registerXPooledConnectionEventListener

          public void registerXPooledConnectionEventListener(XPooledConnectionEventListener listener)

      Specified by:
        `registerXPooledConnectionEventListener` in interface `XPooledConnection`

    - #### unregisterXPooledConnectionEventListener

          public void unregisterXPooledConnectionEventListener(XPooledConnectionEventListener listener)

      Specified by:
        `unregisterXPooledConnectionEventListener` in interface `XPooledConnection`

    - #### fireOnXPooledConnectionTerminated

          protected void fireOnXPooledConnectionTerminated()

    - #### getTestQuery

          protected java.lang.String getTestQuery()

    - #### updateLastTimeReleased

          protected void updateLastTimeReleased()

    - #### getCurrentConnectionProxy

          protected Reapable getCurrentConnectionProxy()

    - #### canBeRecycledForCallingThread

          public boolean canBeRecycledForCallingThread()

      Description copied from interface: `XPooledConnection`
      Can the connection be recycled (if not available) for the calling thread?
      Specified by:
        `canBeRecycledForCallingThread` in interface `XPooledConnection`
      Returns:

    - #### getDefaultIsolationLevel

          protected int getDefaultIsolationLevel()

    - #### getCreationTime

          public long getCreationTime()

      Description copied from interface: `XPooledConnection`
      Get the moment when the connection was created.
      Specified by:
        `getCreationTime` in interface `XPooledConnection`
      Returns:

    - #### markAsBeingAcquiredIfAvailable

          public boolean markAsBeingAcquiredIfAvailable()

      Description copied from interface: `XPooledConnection`
      Attempt to claim this connection for use.
      Specified by:
        `markAsBeingAcquiredIfAvailable` in interface `XPooledConnection`
      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.

    - #### doCreateConnectionProxy

          protected abstract Reapable doCreateConnectionProxy()
                                                       throws CreateConnectionException

      Throws:
        `CreateConnectionException`

    - #### testUnderlyingConnection

          protected abstract void testUnderlyingConnection()
                                                    throws CreateConnectionException

      Throws:
        `CreateConnectionException`

Copyright © 2018. All Rights Reserved.