org.jboss.jca.core.connectionmanager

## Class AbstractConnectionManager

- java.lang.Object
- - org.jboss.jca.core.connectionmanager.AbstractConnectionManager

- All Implemented Interfaces:
    java.io.Serializable, javax.resource.spi.ConnectionManager, javax.resource.spi.LazyAssociatableConnectionManager, javax.resource.spi.LazyEnlistableConnectionManager, org.jboss.jca.core.api.connectionmanager.listener.ConnectionCacheListener, org.jboss.jca.core.spi.graceful.GracefulShutdown
  Direct Known Subclasses:
    NoTxConnectionManagerImpl, TxConnectionManagerImpl

      public abstract class AbstractConnectionManager
      extends java.lang.Object
      implements ConnectionManager

  AbstractConnectionManager.
  Author:
    Gurkan Erdogdu, Jesper Pedersen
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected boolean` | `connectable` Connectable
    `protected boolean` | `enlistment` Enlistment
    `protected org.jboss.jca.core.api.management.ManagedEnlistmentTrace` | `enlistmentTrace` Enlistment trace
    `protected java.lang.Boolean` | `tracking` Tracking

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `AbstractConnectionManager()` Creates a new instance of connection manager.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.Object` | `allocateConnection(javax.resource.spi.ManagedConnectionFactory mcf, javax.resource.spi.ConnectionRequestInfo cri)`
    `void` | `associateConnection(java.lang.Object connection, javax.resource.spi.ManagedConnectionFactory mcf, javax.resource.spi.ConnectionRequestInfo cri)`
    `javax.resource.spi.ManagedConnection` | `associateManagedConnection(java.lang.Object connection, javax.resource.spi.ManagedConnectionFactory mcf, javax.resource.spi.ConnectionRequestInfo cri)` Associate a managed connection to a logical connection
    `boolean` | `cancelShutdown()` Cancel shutdown
    `protected void` | `disconnectManagedConnection(ConnectionListener cl)` Invoked when a managed connection is no longer associated
    `boolean` | `dissociateManagedConnection(java.lang.Object connection, javax.resource.spi.ManagedConnection mc, javax.resource.spi.ManagedConnectionFactory mcf)` Dissociate a managed connection from a logical connection.
    `int` | `getAllocationRetry()` Get the number of allocation retries
    `long` | `getAllocationRetryWaitMillis()` Get the wait time between each allocation retry
    `org.jboss.jca.core.api.connectionmanager.ccm.CachedConnectionManager` | `getCachedConnectionManager()` Gets cached connection manager.
    `int` | `getDelay()` Get the delay until shutdown occurs
    `org.jboss.jca.core.api.management.ManagedEnlistmentTrace` | `getEnlistmentTrace()` Get enlistment trace
    `org.jboss.jca.common.api.metadata.common.FlushStrategy` | `getFlushStrategy()` Get the flush strategy
    `java.lang.String` | `getJndiName()` Gets jndi name.
    `protected abstract CoreLogger` | `getLogger()` Get the logger.
    `ConnectionListener` | `getManagedConnection(javax.security.auth.Subject subject, javax.resource.spi.ConnectionRequestInfo cri)` Public for use in testing pooling functionality by itself.
    `protected ConnectionListener` | `getManagedConnection(javax.transaction.Transaction transaction, javax.security.auth.Subject subject, javax.resource.spi.ConnectionRequestInfo cri)` Get the managed connection from the pool.
    `javax.resource.spi.ManagedConnectionFactory` | `getManagedConnectionFactory()` Gets managed connection factory.
    `Pool` | `getPool()` Get the pool.
    `java.lang.String` | `getSecurityDomain()` Get the security domain.
    `org.jboss.jca.core.spi.security.SubjectFactory` | `getSubjectFactory()` Get the subject factory
    `java.lang.Boolean` | `getTracking()` Get tracking
    `abstract org.jboss.jca.core.spi.transaction.TransactionIntegration` | `getTransactionIntegration()` Get the transaction integration.
    `void` | `inactiveConnectionClosed(java.lang.Object connection, javax.resource.spi.ManagedConnectionFactory mcf)`
    `boolean` | `isConnectable()` Is connectable
    `boolean` | `isEnlistment()` Is enlistment
    `boolean` | `isSharable()` Is sharable
    `boolean` | `isShutdown()` Is the component shutdown
    `abstract boolean` | `isTransactional()` Determine whether there connection is a transactional.
    `void` | `lazyEnlist(javax.resource.spi.ManagedConnection mc)`
    `protected void` | `managedConnectionDisconnected(ConnectionListener cl)`
    `protected void` | `managedConnectionReconnected(ConnectionListener cl)` For polymorphism.
    `void` | `prepareShutdown()` Signal the component to prepare for shutdown
    `void` | `prepareShutdown(org.jboss.jca.core.spi.graceful.GracefulCallback cb)` Signal the component to prepare for shutdown
    `void` | `prepareShutdown(int seconds)` Signal the component to prepare for shutdown
    `void` | `prepareShutdown(int seconds, org.jboss.jca.core.spi.graceful.GracefulCallback cb)` Signal the component to prepare for shutdown
    `protected void` | `reconnectManagedConnection(ConnectionListener cl)` Invoked to reassociate a managed connection.
    `void` | `returnManagedConnection(org.jboss.jca.core.api.connectionmanager.listener.ConnectionListener bcl, boolean kill)` Kill given connection listener wrapped connection instance.
    `void` | `setAllocationRetry(int number)` Set the number of allocation retries
    `void` | `setAllocationRetryWaitMillis(long millis)` Set the wait time between each allocation retry
    `void` | `setCachedConnectionManager(org.jboss.jca.core.api.connectionmanager.ccm.CachedConnectionManager cachedConnectionManager)` Sets cached connection manager.
    `void` | `setConnectable(boolean v)` Set the connectable flag
    `void` | `setEnlistment(boolean v)` Set the enlistment flag
    `void` | `setEnlistmentTrace(org.jboss.jca.core.api.management.ManagedEnlistmentTrace v)` Set the enlistment trace flag
    `void` | `setFlushStrategy(org.jboss.jca.common.api.metadata.common.FlushStrategy v)` Set the flush strategy
    `void` | `setJndiName(java.lang.String jndiName)` Sets jndi name.
    `void` | `setPool(Pool pool)` Set the pool.
    `void` | `setSecurityDomain(java.lang.String securityDomain)` Sets security domain
    `void` | `setSharable(boolean v)` Set the sharable flag
    `void` | `setSubjectFactory(org.jboss.jca.core.spi.security.SubjectFactory subjectFactory)` Sets subject factory.
    `void` | `setTracking(java.lang.Boolean v)` Set the tracking flag
    `void` | `shutdown()` Shutdown the component
    `abstract void` | `transactionStarted(java.util.Collection<ConnectionRecord> conns)` Notification of transaction started
    `void` | `unregisterAssociation(ConnectionListener cl, java.lang.Object c)` Unregister association.

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

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

    - ### Methods inherited from interface org.jboss.jca.core.connectionmanager.ConnectionManager

      `createConnectionListener`

- - ### Field Detail

    - #### enlistment

          protected boolean enlistment

      Enlistment

    - #### connectable

          protected boolean connectable

      Connectable

    - #### tracking

          protected java.lang.Boolean tracking

      Tracking

    - #### enlistmentTrace

          protected org.jboss.jca.core.api.management.ManagedEnlistmentTrace enlistmentTrace

      Enlistment trace

  - ### Constructor Detail

    - #### AbstractConnectionManager

          protected AbstractConnectionManager()

      Creates a new instance of connection manager.

  - ### Method Detail

    - #### getLogger

          protected abstract CoreLogger getLogger()

      Get the logger.
      Returns:
        The value

    - #### setPool

          public void setPool(Pool pool)

      Set the pool.
      Parameters:
        `pool` - the pool

    - #### getPool

          public Pool getPool()

      Get the pool.
      Returns:
        the pool

    - #### setCachedConnectionManager

          public void setCachedConnectionManager(org.jboss.jca.core.api.connectionmanager.ccm.CachedConnectionManager cachedConnectionManager)

      Sets cached connection manager.
      Parameters:
        `cachedConnectionManager` - cached connection manager

    - #### getCachedConnectionManager

          public org.jboss.jca.core.api.connectionmanager.ccm.CachedConnectionManager getCachedConnectionManager()

      Gets cached connection manager.
      Returns:
        cached connection manager

    - #### cancelShutdown

          public boolean cancelShutdown()

      Cancel shutdown
      Specified by:
        `cancelShutdown` in interface `org.jboss.jca.core.spi.graceful.GracefulShutdown`
      Returns:
        True if the shutdown was canceled; false otherwise

    - #### prepareShutdown

          public void prepareShutdown()

      Signal the component to prepare for shutdown
      Specified by:
        `prepareShutdown` in interface `org.jboss.jca.core.spi.graceful.GracefulShutdown`

    - #### prepareShutdown

          public void prepareShutdown(org.jboss.jca.core.spi.graceful.GracefulCallback cb)

      Signal the component to prepare for shutdown
      Specified by:
        `prepareShutdown` in interface `org.jboss.jca.core.spi.graceful.GracefulShutdown`
      Parameters:
        `cb` - The callback handle

    - #### prepareShutdown

          public void prepareShutdown(int seconds)

      Signal the component to prepare for shutdown
      Specified by:
        `prepareShutdown` in interface `org.jboss.jca.core.spi.graceful.GracefulShutdown`
      Parameters:
        `seconds` - The number of seconds after which shutdown is forced

    - #### prepareShutdown

          public void prepareShutdown(int seconds,
                                      org.jboss.jca.core.spi.graceful.GracefulCallback cb)

      Signal the component to prepare for shutdown
      Specified by:
        `prepareShutdown` in interface `org.jboss.jca.core.spi.graceful.GracefulShutdown`
      Parameters:
        `seconds` - The number of seconds after which shutdown is forced
        `cb` - The callback handle

    - #### shutdown

          public void shutdown()

      Shutdown the component
      Specified by:
        `shutdown` in interface `org.jboss.jca.core.spi.graceful.GracefulShutdown`

    - #### isShutdown

          public boolean isShutdown()

      Is the component shutdown
      Specified by:
        `isShutdown` in interface `org.jboss.jca.core.spi.graceful.GracefulShutdown`
      Returns:
        True if shutdown; false if active

    - #### getDelay

          public int getDelay()

      Get the delay until shutdown occurs
      Specified by:
        `getDelay` in interface `org.jboss.jca.core.spi.graceful.GracefulShutdown`
      Returns:
        The number of seconds, `Integer.MAX_VALUE` for active, or `Integer.MIN_VALUE` for inactive

    - #### getJndiName

          public java.lang.String getJndiName()

      Gets jndi name.
      Returns:
        jndi name

    - #### setJndiName

          public void setJndiName(java.lang.String jndiName)

      Sets jndi name.
      Parameters:
        `jndiName` - jndi name

    - #### isSharable

          public boolean isSharable()

      Is sharable
      Returns:
        The value

    - #### setSharable

          public void setSharable(boolean v)

      Set the sharable flag
      Parameters:
        `v` - The value

    - #### isEnlistment

          public boolean isEnlistment()

      Is enlistment
      Returns:
        The value

    - #### setEnlistment

          public void setEnlistment(boolean v)

      Set the enlistment flag
      Parameters:
        `v` - The value

    - #### isConnectable

          public boolean isConnectable()

      Is connectable
      Returns:
        The value

    - #### setConnectable

          public void setConnectable(boolean v)

      Set the connectable flag
      Parameters:
        `v` - The value

    - #### getTracking

          public java.lang.Boolean getTracking()

      Get tracking
      Returns:
        The value

    - #### setTracking

          public void setTracking(java.lang.Boolean v)

      Set the tracking flag
      Parameters:
        `v` - The value

    - #### getEnlistmentTrace

          public org.jboss.jca.core.api.management.ManagedEnlistmentTrace getEnlistmentTrace()

      Get enlistment trace
      Returns:
        The value

    - #### setEnlistmentTrace

          public void setEnlistmentTrace(org.jboss.jca.core.api.management.ManagedEnlistmentTrace v)

      Set the enlistment trace flag
      Parameters:
        `v` - The value

    - #### getSecurityDomain

          public java.lang.String getSecurityDomain()

      Get the security domain.
      Returns:
        The value

    - #### setSecurityDomain

          public void setSecurityDomain(java.lang.String securityDomain)

      Sets security domain
      Parameters:
        `securityDomain` - security domain

    - #### getSubjectFactory

          public org.jboss.jca.core.spi.security.SubjectFactory getSubjectFactory()

      Get the subject factory
      Returns:
        The value

    - #### setSubjectFactory

          public void setSubjectFactory(org.jboss.jca.core.spi.security.SubjectFactory subjectFactory)

      Sets subject factory.
      Parameters:
        `subjectFactory` - subject factory

    - #### getFlushStrategy

          public org.jboss.jca.common.api.metadata.common.FlushStrategy getFlushStrategy()

      Get the flush strategy
      Returns:
        The value

    - #### setFlushStrategy

          public void setFlushStrategy(org.jboss.jca.common.api.metadata.common.FlushStrategy v)

      Set the flush strategy
      Parameters:
        `v` - The value

    - #### getManagedConnectionFactory

          public javax.resource.spi.ManagedConnectionFactory getManagedConnectionFactory()

      Gets managed connection factory.
      Returns:
        managed connection factory

    - #### setAllocationRetry

          public void setAllocationRetry(int number)

      Set the number of allocation retries
      Parameters:
        `number` - retry number

    - #### getAllocationRetry

          public int getAllocationRetry()

      Get the number of allocation retries
      Returns:
        The number of retries

    - #### setAllocationRetryWaitMillis

          public void setAllocationRetryWaitMillis(long millis)

      Set the wait time between each allocation retry
      Parameters:
        `millis` - wait in ms

    - #### getAllocationRetryWaitMillis

          public long getAllocationRetryWaitMillis()

      Get the wait time between each allocation retry
      Returns:
        The millis

    - #### getManagedConnection

          public ConnectionListener getManagedConnection(javax.security.auth.Subject subject,
                                                         javax.resource.spi.ConnectionRequestInfo cri)
                                                  throws javax.resource.ResourceException

      Public for use in testing pooling functionality by itself. called by both allocateConnection and reconnect.
      Parameters:
        `subject` - a `Subject` value
        `cri` - a `ConnectionRequestInfo` value
      Returns:
        a `ManagedConnection` value
      Throws:
        `javax.resource.ResourceException` - if an error occurs

    - #### getManagedConnection

          protected ConnectionListener getManagedConnection(javax.transaction.Transaction transaction,
                                                            javax.security.auth.Subject subject,
                                                            javax.resource.spi.ConnectionRequestInfo cri)
                                                     throws javax.resource.ResourceException

      Get the managed connection from the pool.
      Parameters:
        `transaction` - the transaction for track by transaction
        `subject` - the subject
        `cri` - the ConnectionRequestInfo
      Returns:
        a managed connection
      Throws:
        `javax.resource.ResourceException` - if an error occurs

    - #### returnManagedConnection

          public void returnManagedConnection(org.jboss.jca.core.api.connectionmanager.listener.ConnectionListener bcl,
                                              boolean kill)

      Kill given connection listener wrapped connection instance.
      Parameters:
        `bcl` - connection listener that wraps connection
        `kill` - kill connection or not

    - #### allocateConnection

          public java.lang.Object allocateConnection(javax.resource.spi.ManagedConnectionFactory mcf,
                                                     javax.resource.spi.ConnectionRequestInfo cri)
                                              throws javax.resource.ResourceException

      Specified by:
        `allocateConnection` in interface `javax.resource.spi.ConnectionManager`
      Throws:
        `javax.resource.ResourceException`

    - #### associateConnection

          public void associateConnection(java.lang.Object connection,
                                          javax.resource.spi.ManagedConnectionFactory mcf,
                                          javax.resource.spi.ConnectionRequestInfo cri)
                                   throws javax.resource.ResourceException

      Specified by:
        `associateConnection` in interface `javax.resource.spi.LazyAssociatableConnectionManager`
      Throws:
        `javax.resource.ResourceException`

    - #### associateManagedConnection

          public javax.resource.spi.ManagedConnection associateManagedConnection(java.lang.Object connection,
                                                                                 javax.resource.spi.ManagedConnectionFactory mcf,
                                                                                 javax.resource.spi.ConnectionRequestInfo cri)
                                                                          throws javax.resource.ResourceException

      Associate a managed connection to a logical connection
      Parameters:
        `connection` - The connection
        `mcf` - The managed connection factory
        `cri` - The connection request information
      Returns:
        The managed connection
      Throws:
        `javax.resource.ResourceException` - Thrown if an error occurs

    - #### dissociateManagedConnection

          public boolean dissociateManagedConnection(java.lang.Object connection,
                                                     javax.resource.spi.ManagedConnection mc,
                                                     javax.resource.spi.ManagedConnectionFactory mcf)
                                              throws javax.resource.ResourceException

      Dissociate a managed connection from a logical connection. The return value of this method will indicate if the managed connection has more connections attached (false), or if it was return to the pool (true). If the managed connection is return to the pool its `cleanup` method will be called
      Parameters:
        `connection` - The connection
        `mc` - The managed connection
        `mcf` - The managed connection factory
      Returns:
        True if the managed connection was freed; otherwise false
      Throws:
        `javax.resource.ResourceException` - Thrown if an error occurs

    - #### inactiveConnectionClosed

          public void inactiveConnectionClosed(java.lang.Object connection,
                                               javax.resource.spi.ManagedConnectionFactory mcf)

      Specified by:
        `inactiveConnectionClosed` in interface `javax.resource.spi.LazyAssociatableConnectionManager`

    - #### unregisterAssociation

          public void unregisterAssociation(ConnectionListener cl,
                                            java.lang.Object c)

      Unregister association.
      Parameters:
        `cl` - connection listener
        `c` - connection

    - #### lazyEnlist

          public void lazyEnlist(javax.resource.spi.ManagedConnection mc)
                          throws javax.resource.ResourceException

      Specified by:
        `lazyEnlist` in interface `javax.resource.spi.LazyEnlistableConnectionManager`
      Throws:
        `javax.resource.ResourceException`

    - #### reconnectManagedConnection

          protected void reconnectManagedConnection(ConnectionListener cl)
                                             throws javax.resource.ResourceException

      Invoked to reassociate a managed connection.
      Parameters:
        `cl` - the managed connection
      Throws:
        `javax.resource.ResourceException` - for exception

    - #### disconnectManagedConnection

          protected void disconnectManagedConnection(ConnectionListener cl)

      Invoked when a managed connection is no longer associated
      Parameters:
        `cl` - the managed connection

    - #### managedConnectionReconnected

          protected void managedConnectionReconnected(ConnectionListener cl)
                                               throws javax.resource.ResourceException

      For polymorphism.

      Do not invoke directly, use reconnectManagedConnection which does the relevent exception handling

      Parameters:
        `cl` - connection listener
      Throws:
        `javax.resource.ResourceException` - for exception

    - #### managedConnectionDisconnected

          protected void managedConnectionDisconnected(ConnectionListener cl)
                                                throws javax.resource.ResourceException

      Parameters:
        `cl` - connection listener
      Throws:
        `javax.resource.ResourceException` - for exception

    - #### transactionStarted

          public abstract void transactionStarted(java.util.Collection<ConnectionRecord> conns)
                                           throws javax.transaction.SystemException

      Notification of transaction started
      Parameters:
        `conns` - the connections
      Throws:
        `javax.transaction.SystemException` - for any error

    - #### isTransactional

          public abstract boolean isTransactional()

      Determine whether there connection is a transactional.
      Returns:
        whether it is a transactional or not

    - #### getTransactionIntegration

          public abstract org.jboss.jca.core.spi.transaction.TransactionIntegration getTransactionIntegration()

      Get the transaction integration.
      Returns:
        the transaction integration

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