org.jboss.jca.core.connectionmanager.listener

## Interface ConnectionListener

- All Superinterfaces:
    java.lang.Comparable, javax.resource.spi.ConnectionEventListener, org.jboss.jca.core.api.connectionmanager.listener.ConnectionListener, java.util.EventListener

      public interface ConnectionListener
      extends org.jboss.jca.core.api.connectionmanager.listener.ConnectionListener

  Connection listener.
  Author:
    Gurkan Erdogdu, Adrian Brock, Weston Price, Jesper Pedersen

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `controls(javax.resource.spi.ManagedConnection mc, java.lang.Object connection)` Controls the managed connection / connection pair
    `boolean` | `delist()` Delist the managed connection
    `void` | `destroy()` Destroys this connection listener and its managed connection.
    `void` | `dissociate()` Dissociate the connection listener
    `void` | `enlist()` Enlist the managed connection
    `java.lang.Exception` | `getException()` Get exception
    `long` | `getLastCheckedOutTime()` Retrieve the last time this connection was obtained from the pool
    `long` | `getLastReturnedTime()` Retrieve the last time this connection was returned to the pool
    `long` | `getLastValidatedTime()` Retrieve the last time this connection was validated.
    `ManagedConnectionPool` | `getManagedConnectionPool()` Get the managed connection pool
    `int` | `getNumberOfConnections()` Get number of connection handles
    `Pool` | `getPool()` Retrieve the pool for this listener.
    `ConnectionState` | `getState()` Retrieve the state of this connection.
    `boolean` | `isEnlisted()` Is enlisted
    `boolean` | `isManagedConnectionFree()` Is the managed connection free?
    `boolean` | `isTimedOut(long timeout)` Has the connection timed out?
    `boolean` | `isTrackByTx()` Get whether the listener is track by transaction
    `void` | `registerConnection(java.lang.Object handle)` Register a new connection
    `void` | `setLastCheckedOutTime(long v)` Set the last time this connection was obtained from the pool
    `void` | `setLastValidatedTime(long lastValidated)` Set the last time, in milliseconds, that this connection was validated.
    `void` | `setState(ConnectionState newState)` Set the state of this connection.
    `void` | `setTrackByTx(boolean trackByTx)` Set whether the listener is track by transaction
    `boolean` | `supportsLazyAssociation()` Supports lazy association
    `boolean` | `supportsLazyEnlistment()` Supports lazy enlistment
    `void` | `tidyup()` Tidyup Invoked just before returning the connection to the pool when the connection is not being destroyed.
    `void` | `toPool()` Mark the connection as in pool
    `void` | `unregisterConnection(java.lang.Object handle)` Unregister a connection
    `void` | `unregisterConnections()` Unregister all connections

    - ### Methods inherited from interface org.jboss.jca.core.api.connectionmanager.listener.ConnectionListener

      `getManagedConnection`

    - ### Methods inherited from interface javax.resource.spi.ConnectionEventListener

      `connectionClosed, connectionErrorOccurred, localTransactionCommitted, localTransactionRolledback, localTransactionStarted`

    - ### Methods inherited from interface java.lang.Comparable

      `compareTo`

- - ### Method Detail

    - #### getNumberOfConnections

          int getNumberOfConnections()

      Get number of connection handles
      Returns:
        The value

    - #### getPool

          Pool getPool()

      Retrieve the pool for this listener.
      Returns:
        the pool

    - #### tidyup

          void tidyup()
               throws javax.resource.ResourceException

      Tidyup

      Invoked just before returning the connection to the pool when the connection is not being destroyed.

      Throws:
        `javax.resource.ResourceException` - for any error

    - #### getManagedConnectionPool

          ManagedConnectionPool getManagedConnectionPool()

      Get the managed connection pool
      Returns:
        The value

    - #### getState

          ConnectionState getState()

      Retrieve the state of this connection.
      Returns:
        the state

    - #### setState

          void setState(ConnectionState newState)

      Set the state of this connection.
      Parameters:
        `newState` - new state

    - #### isTimedOut

          boolean isTimedOut(long timeout)

      Has the connection timed out?
      Parameters:
        `timeout` - the timeout
      Returns:
        true for timed out, false otherwise

    - #### toPool

          void toPool()

      Mark the connection as in pool

    - #### registerConnection

          void registerConnection(java.lang.Object handle)

      Register a new connection
      Parameters:
        `handle` - the connection handle

    - #### unregisterConnection

          void unregisterConnection(java.lang.Object handle)

      Unregister a connection
      Parameters:
        `handle` - the connection handle

    - #### unregisterConnections

          void unregisterConnections()

      Unregister all connections

    - #### isManagedConnectionFree

          boolean isManagedConnectionFree()

      Is the managed connection free?
      Returns:
        true when it is free

    - #### isEnlisted

          boolean isEnlisted()

      Is enlisted
      Returns:
        True if enlisted, otherwise false

    - #### enlist

          void enlist()
               throws javax.transaction.SystemException

      Enlist the managed connection
      Throws:
        `javax.transaction.SystemException` - for errors

    - #### delist

          boolean delist()
                  throws javax.resource.ResourceException

      Delist the managed connection
      Returns:
        `True` if the listener was delisted succesfully, otherwise `false`
      Throws:
        `javax.resource.ResourceException` - if exception occurs

    - #### isTrackByTx

          boolean isTrackByTx()

      Get whether the listener is track by transaction
      Returns:
        true for track by transaction, false otherwise

    - #### setTrackByTx

          void setTrackByTx(boolean trackByTx)

      Set whether the listener is track by transaction
      Parameters:
        `trackByTx` - true for track by transaction, false otherwise

    - #### getLastValidatedTime

          long getLastValidatedTime()

      Retrieve the last time this connection was validated.
      Returns:
        the last time the connection was validated

    - #### setLastValidatedTime

          void setLastValidatedTime(long lastValidated)

      Set the last time, in milliseconds, that this connection was validated.
      Parameters:
        `lastValidated` - the last time the connection was validated in milliseconds.

    - #### getLastReturnedTime

          long getLastReturnedTime()

      Retrieve the last time this connection was returned to the pool
      Returns:
        the last time the connection was returned to the pool

    - #### getLastCheckedOutTime

          long getLastCheckedOutTime()

      Retrieve the last time this connection was obtained from the pool
      Returns:
        the last time the connection was obtained from the pool

    - #### setLastCheckedOutTime

          void setLastCheckedOutTime(long v)

      Set the last time this connection was obtained from the pool
      Parameters:
        `v` - The value

    - #### getException

          java.lang.Exception getException()

      Get exception
      Returns:
        The exception that occured, or `null`

    - #### controls

          boolean controls(javax.resource.spi.ManagedConnection mc,
                           java.lang.Object connection)

      Controls the managed connection / connection pair
      Parameters:
        `mc` - The managed connection
        `connection` - The connection; optional
      Returns:
        True if the connection listener controls the pair, otherwise false

    - #### dissociate

          void dissociate()
                   throws javax.resource.ResourceException

      Dissociate the connection listener
      Throws:
        `javax.resource.ResourceException` - if exception occurs

    - #### supportsLazyAssociation

          boolean supportsLazyAssociation()

      Supports lazy association
      Returns:
        `True` if supported, otherwise `false`

    - #### supportsLazyEnlistment

          boolean supportsLazyEnlistment()

      Supports lazy enlistment
      Returns:
        `True` if supported, otherwise `false`

    - #### destroy

          void destroy()

      Destroys this connection listener and its managed connection.

Copyright © 2014 IronJacamar (http://www.ironjacamar.org)