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

com.atomikos.datasource.pool

## Class ConnectionPool

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

- All Implemented Interfaces:
    XPooledConnectionEventListener
  Direct Known Subclasses:
    ConnectionPoolWithConcurrentValidation, ConnectionPoolWithSynchronizedValidation

      public abstract class ConnectionPool
      extends java.lang.Object
      implements XPooledConnectionEventListener

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.util.List<XPooledConnection>` | `connections`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ConnectionPool(ConnectionFactory connectionFactory, ConnectionPoolProperties properties)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `assertNotDestroyed()`
    `int` | `availableSize()` The amount of pooled connections in state available.
    `Reapable` | `borrowConnection()` Borrows a connection from the pool.
    `void` | `destroy()`
    `protected void` | `destroyPooledConnection(XPooledConnection xpc)`
    `protected Reapable` | `findExistingOpenConnectionForCallingThread()`
    `protected Reapable` | `findOrWaitForAnAvailableConnection()`
    `protected void` | `logCurrentPoolSize()`
    `void` | `onXPooledConnectionTerminated(XPooledConnection connection)` fired when a connection changed its state to terminated
    `void` | `reapPool()`
    `protected Reapable` | `recycleConnectionIfPossible()`
    `void` | `refresh()`
    `protected Reapable` | `retrieveFirstAvailableConnection()`
    `java.lang.String` | `toString()`
    `int` | `totalSize()` The total amount of pooled connections in any state.

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

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

- - ### Field Detail

    - #### connections

          protected java.util.List<XPooledConnection> connections

  - ### Constructor Detail

    - #### ConnectionPool

          public ConnectionPool(ConnectionFactory connectionFactory,
                        ConnectionPoolProperties properties)
                         throws ConnectionPoolException

      Throws:
        `ConnectionPoolException`

  - ### Method Detail

    - #### assertNotDestroyed

          protected void assertNotDestroyed()
                                     throws ConnectionPoolException

      Throws:
        `ConnectionPoolException`

    - #### recycleConnectionIfPossible

          protected Reapable recycleConnectionIfPossible()
                                                  throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### borrowConnection

          public Reapable borrowConnection()
                                    throws CreateConnectionException,
                                           PoolExhaustedException,
                                           ConnectionPoolException

      Borrows a connection from the pool.
      Returns:
        The connection as Reapable.
      Throws:
        `CreateConnectionException` - If the pool attempted to grow but failed.
        `PoolExhaustedException` - If the pool could not grow because it is exhausted.
        `ConnectionPoolException` - Other errors.

    - #### findOrWaitForAnAvailableConnection

          protected Reapable findOrWaitForAnAvailableConnection()
                                                         throws ConnectionPoolException

      Throws:
        `ConnectionPoolException`

    - #### findExistingOpenConnectionForCallingThread

          protected Reapable findExistingOpenConnectionForCallingThread()

    - #### logCurrentPoolSize

          protected void logCurrentPoolSize()

    - #### retrieveFirstAvailableConnection

          protected Reapable retrieveFirstAvailableConnection()

    - #### destroyPooledConnection

          protected void destroyPooledConnection(XPooledConnection xpc)

    - #### reapPool

          public void reapPool()

    - #### destroy

          public void destroy()

    - #### refresh

          public void refresh()

    - #### availableSize

          public int availableSize()

      The amount of pooled connections in state available.
      Returns:
        the amount of pooled connections in state available.

    - #### totalSize

          public int totalSize()

      The total amount of pooled connections in any state.
      Returns:
        the total amount of pooled connections in any state

    - #### onXPooledConnectionTerminated

          public void onXPooledConnectionTerminated(XPooledConnection connection)

      Description copied from interface: `XPooledConnectionEventListener`
      fired when a connection changed its state to terminated
      Specified by:
        `onXPooledConnectionTerminated` in interface `XPooledConnectionEventListener`

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

Copyright © 2018. All Rights Reserved.