org.jboss.jca.core.connectionmanager
Class AbstractConnectionManager

java.lang.Object
  extended by org.jboss.jca.core.connectionmanager.AbstractConnectionManager
All Implemented Interfaces:
Serializable, javax.resource.spi.ConnectionManager, org.jboss.jca.core.api.connectionmanager.listener.ConnectionCacheListener, ConnectionListenerFactory
Direct Known Subclasses:
NoTxConnectionManagerImpl, TxConnectionManagerImpl

public abstract class AbstractConnectionManager
extends Object
implements ConnectionManager

AbstractConnectionManager.

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

Field Summary
protected  boolean trace
          Log trace
 
Constructor Summary
protected AbstractConnectionManager()
          Creates a new instance of connection manager.
 
Method Summary
 Object allocateConnection(javax.resource.spi.ManagedConnectionFactory mcf, javax.resource.spi.ConnectionRequestInfo cri)
          
 void disconnect(Collection<ConnectionRecord> conRecords, Set<String> unsharableResources)
          Notification to disconnect connections
protected  void disconnectManagedConnection(ConnectionListener cl)
          Invoked when a managed connection is no longer associated
 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.
 org.jboss.jca.common.api.metadata.common.FlushStrategy getFlushStrategy()
          Get the flush strategy
 String getJndiName()
          Gets jndi name.
protected abstract  CoreLogger getLogger()
          Get the logger.
 ConnectionListener getManagedConnection(Subject subject, javax.resource.spi.ConnectionRequestInfo cri)
          Public for use in testing pooling functionality by itself.
protected  ConnectionListener getManagedConnection(Transaction transaction, 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.
 String getSecurityDomain()
          Get the security domain.
 org.jboss.security.SubjectFactory getSubjectFactory()
          Get the subject factory
abstract  org.jboss.jca.core.spi.transaction.TransactionIntegration getTransactionIntegration()
          Get the transaction integration.
abstract  boolean isTransactional()
          Determine whether there connection is a transactional.
protected  void managedConnectionDisconnected(ConnectionListener cl)
          For polymorphism.
protected  void managedConnectionReconnected(ConnectionListener cl)
          For polymorphism.
 void reconnect(Collection<ConnectionRecord> conns, Set<String> unsharableResources)
          Notification to reconnect connections
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 setFlushStrategy(org.jboss.jca.common.api.metadata.common.FlushStrategy v)
          Set the flush strategy
 void setJndiName(String jndiName)
          Sets jndi name.
 void setPool(Pool pool)
          Set the pool.
 void setSecurityDomain(String securityDomain)
          Sets security domain
 void setShutDown(boolean shutDown)
          Sets shut down flag.
 void setSubjectFactory(org.jboss.security.SubjectFactory subjectFactory)
          Sets subject factory.
 void setUserTransactionRegistry(org.jboss.jca.core.spi.transaction.usertx.UserTransactionRegistry utr)
          Set the user transaction registry
abstract  void transactionStarted(Collection<ConnectionRecord> conns)
          Notification of transaction started
 void unregisterAssociation(ConnectionListener cl, 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.listener.ConnectionListenerFactory
createConnectionListener
 

Field Detail

trace

protected boolean trace
Log 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

setUserTransactionRegistry

public void setUserTransactionRegistry(org.jboss.jca.core.spi.transaction.usertx.UserTransactionRegistry utr)
Set the user transaction registry

Parameters:
utr - The value

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

setShutDown

public void setShutDown(boolean shutDown)
Sets shut down flag.

Parameters:
shutDown - shut down flag

getJndiName

public String getJndiName()
Gets jndi name.

Returns:
jndi name

setJndiName

public void setJndiName(String jndiName)
Sets jndi name.

Parameters:
jndiName - jndi name

getSecurityDomain

public String getSecurityDomain()
Get the security domain.

Returns:
The value

setSecurityDomain

public void setSecurityDomain(String securityDomain)
Sets security domain

Parameters:
securityDomain - security domain

getSubjectFactory

public org.jboss.security.SubjectFactory getSubjectFactory()
Get the subject factory

Returns:
The value

setSubjectFactory

public void setSubjectFactory(org.jboss.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(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(Transaction transaction,
                                                  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 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

disconnect

public void disconnect(Collection<ConnectionRecord> conRecords,
                       Set<String> unsharableResources)
                throws javax.resource.ResourceException
Notification to disconnect connections

Parameters:
conRecords - the connections
unsharableResources - the unshareable resources
Throws:
javax.resource.ResourceException - for any error

reconnect

public void reconnect(Collection<ConnectionRecord> conns,
                      Set<String> unsharableResources)
               throws javax.resource.ResourceException
Notification to reconnect connections

Parameters:
conns - the connections
unsharableResources - unshareable resources
Throws:
javax.resource.ResourceException - for any error

unregisterAssociation

public void unregisterAssociation(ConnectionListener cl,
                                  Object c)
Unregister association.

Parameters:
cl - connection listener
c - connection

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
For polymorphism.

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

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

transactionStarted

public abstract void transactionStarted(Collection<ConnectionRecord> conns)
                                 throws SystemException
Notification of transaction started

Parameters:
conns - the connections
Throws:
SystemException - for any error

isTransactional

public abstract boolean isTransactional()
Determine whether there connection is a transactional.

Specified by:
isTransactional in interface ConnectionListenerFactory
Returns:
whether it is a transactional or not

getTransactionIntegration

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

Specified by:
getTransactionIntegration in interface ConnectionListenerFactory
Returns:
the transaction integration


Copyright © 2008 Red Hat Middleware LLC (http://www.jboss.com/)