站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 3.2.7 connector API Documentation 英文版文档

BaseConnectionManager2 (JBoss Connector API) - JBoss 3.2.7 connector API Documentation 英文版文档


org.jboss.resource.connectionmanager
Class BaseConnectionManager2

java.lang.Object
  extended byorg.jboss.mx.util.JBossNotificationBroadcasterSupport
      extended byorg.jboss.system.ServiceMBeanSupport
          extended byorg.jboss.resource.connectionmanager.BaseConnectionManager2
All Implemented Interfaces:
BaseConnectionManager2MBean, ConnectionCacheListener, ConnectionListenerFactory, javax.management.MBeanRegistration, javax.management.NotificationBroadcaster, javax.management.NotificationEmitter, org.jboss.system.Service, org.jboss.system.ServiceMBean
Direct Known Subclasses:
NoTxConnectionManager, TxConnectionManager

public abstract class BaseConnectionManager2
extends org.jboss.system.ServiceMBeanSupport
implements BaseConnectionManager2MBean, ConnectionCacheListener, ConnectionListenerFactory

The BaseConnectionManager2 is an abstract base class for JBoss ConnectionManager implementations. It includes functionality to obtain managed connections from a ManagedConnectionPool mbean, find the Subject from a SubjectSecurityDomain, and interact with the CachedConnectionManager for connections held over transaction and method boundaries. Important mbean references are to a ManagedConnectionPool supplier (typically a JBossManagedConnectionPool), and a RARDeployment representing the ManagedConnectionFactory.

Version:
$Revision: 1.18.2.27 $
Author:
David Jencks, Erwin Guib, Adrian Brock

Nested Class Summary
protected  class BaseConnectionManager2.BaseConnectionEventListener
           
static class BaseConnectionManager2.ConnectionManagerProxy
           
 
Field Summary
protected  String jndiName
           
protected  ManagedConnectionPool poolingStrategy
           
static String STOPPING_NOTIFICATION
           
protected  boolean trace
           
 
Fields inherited from class org.jboss.system.ServiceMBeanSupport
log, server, SERVICE_CONTROLLER_SIG, serviceName
 
Fields inherited from interface org.jboss.resource.connectionmanager.BaseConnectionManager2MBean
OBJECT_NAME
 
Fields inherited from interface org.jboss.system.ServiceMBean
CREATE_EVENT, CREATED, DESTROY_EVENT, DESTROYED, FAILED, REGISTERED, START_EVENT, STARTED, STARTING, states, STOP_EVENT, STOPPED, STOPPING, UNREGISTERED
 
Constructor Summary
BaseConnectionManager2()
          Default BaseConnectionManager2 managed constructor for use by subclass mbeans.
BaseConnectionManager2(CachedConnectionManager ccm, ManagedConnectionPool poolingStrategy)
          Creates a new BaseConnectionManager2 instance.
 
Method Summary
 Object allocateConnection(javax.resource.spi.ManagedConnectionFactory mcf, javax.resource.spi.ConnectionRequestInfo cri)
           
 void disconnect(Collection crs, Set unsharableResources)
           
 javax.management.ObjectName getCachedConnectionManager()
          Describe getCachedConnectionManager method here.
protected  CachedConnectionManager getCcm()
           
 int getConnectionCount()
           
 BaseConnectionManager2 getInstance()
          Describe getInstance method here.
 javax.management.ObjectName getJaasSecurityManagerService()
          Get the JaasSecurityManagerService value.
 String getJndiName()
          The JndiName attribute holds the jndi name the ConnectionFactory will be bound under in jndi.
 ConnectionListener getManagedConnection(Subject subject, javax.resource.spi.ConnectionRequestInfo cri)
          Describe getManagedConnection method here.
protected  ConnectionListener getManagedConnection(Transaction transaction, Subject subject, javax.resource.spi.ConnectionRequestInfo cri)
          Get the managed connection from the pool
 javax.resource.spi.ManagedConnectionFactory getManagedConnectionFactory()
          ManagedConnectionFactory is an internal attribute that holds the ManagedConnectionFactory instance managed by this ConnectionManager.
 javax.management.ObjectName getManagedConnectionPool()
          The ManagedConnectionPool holds the ObjectName of the mbean representing the pool for this connection manager.
 javax.management.MBeanNotificationInfo[] getNotificationInfo()
           
 ManagedConnectionPool getPoolingStrategy()
          For testing
 String getSecurityDomainJndiName()
          Get the SecurityDomainJndiName value.
 TransactionManager getTransactionManagerInstance()
          Get the transaction manager
 boolean isTransactional()
          Determine whether is a transaction
protected  void managedConnectionDisconnected(ConnectionListener cl)
           
protected  void managedConnectionReconnected(ConnectionListener cl)
           
 void reconnect(Collection conns, Set unsharableResources)
          Describe reconnect method here.
protected static void rethrowAsResourceException(String message, Throwable t)
          Rethrow a throwable as resource exception
 void returnManagedConnection(ConnectionListener cl, boolean kill)
           
 void setCachedConnectionManager(javax.management.ObjectName ccmName)
          The CachecConnectionManager holds the ObjectName of the CachedConnectionManager mbean used by this ConnectionManager.
 void setJaasSecurityManagerService(javax.management.ObjectName jaasSecurityManagerService)
          Set the JaasSecurityManagerService value.
 void setJndiName(String jndiName)
          Set the JndiName value.
 void setManagedConnectionPool(javax.management.ObjectName newManagedConnectionPool)
          Set the ManagedConnectionPool value.
 void setSecurityDomainJndiName(String securityDomainJndiName)
          The SecurityDomainJndiName holds the jndi name of the security domain configured for the ManagedConnectionFactory this ConnectionManager manages.
protected  void startService()
           
protected  void stopService()
           
 void transactionStarted(Collection conns)
           
protected  void unregisterAssociation(ConnectionListener cl, Object c)
           
 
Methods inherited from class org.jboss.system.ServiceMBeanSupport
create, createService, destroy, destroyService, getLog, getName, getNextNotificationSequenceNumber, getObjectName, getServer, getServiceName, getState, getStateString, jbossInternalCreate, jbossInternalDescription, jbossInternalDestroy, jbossInternalLifecycle, jbossInternalStart, jbossInternalStop, postDeregister, postRegister, preDeregister, preRegister, start, stop
 
Methods inherited from class org.jboss.mx.util.JBossNotificationBroadcasterSupport
addNotificationListener, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jboss.system.ServiceMBean
getName, getState, getStateString, jbossInternalLifecycle
 
Methods inherited from interface org.jboss.system.Service
create, destroy, start, stop
 
Methods inherited from interface org.jboss.resource.connectionmanager.ConnectionListenerFactory
createConnectionListener
 

Field Detail

STOPPING_NOTIFICATION

public static final String STOPPING_NOTIFICATION
See Also:
Constant Field Values

poolingStrategy

protected ManagedConnectionPool poolingStrategy

jndiName

protected String jndiName

trace

protected boolean trace
Constructor Detail

BaseConnectionManager2

public BaseConnectionManager2()
Default BaseConnectionManager2 managed constructor for use by subclass mbeans.


BaseConnectionManager2

public BaseConnectionManager2(CachedConnectionManager ccm,
                              ManagedConnectionPool poolingStrategy)
Creates a new BaseConnectionManager2 instance. for TESTING ONLY! not a managed operation.

Parameters:
ccm - a CachedConnectionManager value
poolingStrategy - a ManagedConnectionPool value
Method Detail

rethrowAsResourceException

protected static void rethrowAsResourceException(String message,
                                                 Throwable t)
                                          throws javax.resource.ResourceException
Rethrow a throwable as resource exception

Throws:
javax.resource.ResourceException

getPoolingStrategy

public ManagedConnectionPool getPoolingStrategy()
For testing


getJndiName

public String getJndiName()
The JndiName attribute holds the jndi name the ConnectionFactory will be bound under in jndi. Note that an entry of the form DefaultDS2 will be bound to java:/DefaultDS2.

Specified by:
getJndiName in interface BaseConnectionManager2MBean
Returns:
the JndiName value.

setJndiName

public void setJndiName(String jndiName)
Set the JndiName value.

Specified by:
setJndiName in interface BaseConnectionManager2MBean
Parameters:
jndiName - The JndiName value.

getManagedConnectionPool

public javax.management.ObjectName getManagedConnectionPool()
The ManagedConnectionPool holds the ObjectName of the mbean representing the pool for this connection manager. Normally it will be an embedded mbean in a depends tag rather than an ObjectName reference to the mbean.

Specified by:
getManagedConnectionPool in interface BaseConnectionManager2MBean
Returns:
the ManagedConnectionPool value.

setManagedConnectionPool

public void setManagedConnectionPool(javax.management.ObjectName newManagedConnectionPool)
Set the ManagedConnectionPool value.

Specified by:
setManagedConnectionPool in interface BaseConnectionManager2MBean
Parameters:
newManagedConnectionPool - The new ManagedConnectionPool value.

setCachedConnectionManager

public void setCachedConnectionManager(javax.management.ObjectName ccmName)
The CachecConnectionManager holds the ObjectName of the CachedConnectionManager mbean used by this ConnectionManager. Normally this will be a depends tag with the ObjectName of the unique CachedConnectionManager for the server.

Specified by:
setCachedConnectionManager in interface BaseConnectionManager2MBean
Parameters:
ccmName - an ObjectName value

getCachedConnectionManager

public javax.management.ObjectName getCachedConnectionManager()
Describe getCachedConnectionManager method here.

Specified by:
getCachedConnectionManager in interface BaseConnectionManager2MBean
Returns:
an ObjectName value

setSecurityDomainJndiName

public void setSecurityDomainJndiName(String securityDomainJndiName)
The SecurityDomainJndiName holds the jndi name of the security domain configured for the ManagedConnectionFactory this ConnectionManager manages. It is normally of the form java:/jaas/firebirdRealm, where firebirdRealm is the name found in auth.conf or equivalent file.

Specified by:
setSecurityDomainJndiName in interface BaseConnectionManager2MBean
Parameters:
securityDomainJndiName - an String value

getSecurityDomainJndiName

public String getSecurityDomainJndiName()
Get the SecurityDomainJndiName value.

Specified by:
getSecurityDomainJndiName in interface BaseConnectionManager2MBean
Returns:
the SecurityDomainJndiName value.

getJaasSecurityManagerService

public javax.management.ObjectName getJaasSecurityManagerService()
Get the JaasSecurityManagerService value.

Specified by:
getJaasSecurityManagerService in interface BaseConnectionManager2MBean
Returns:
the JaasSecurityManagerService value.

setJaasSecurityManagerService

public void setJaasSecurityManagerService(javax.management.ObjectName jaasSecurityManagerService)
Set the JaasSecurityManagerService value.

Specified by:
setJaasSecurityManagerService in interface BaseConnectionManager2MBean
Parameters:
jaasSecurityManagerService - The new JaasSecurityManagerService value.

getManagedConnectionFactory

public javax.resource.spi.ManagedConnectionFactory getManagedConnectionFactory()
ManagedConnectionFactory is an internal attribute that holds the ManagedConnectionFactory instance managed by this ConnectionManager.

Specified by:
getManagedConnectionFactory in interface BaseConnectionManager2MBean
Returns:
value of managedConnectionFactory

getInstance

public BaseConnectionManager2 getInstance()
Describe getInstance method here.

Specified by:
getInstance in interface BaseConnectionManager2MBean
Returns:
a BaseConnectionManager2 value

startService

protected void startService()
                     throws Exception
Throws:
Exception

stopService

protected void stopService()
                    throws Exception
Throws:
Exception

getManagedConnection

public ConnectionListener getManagedConnection(Subject subject,
                                               javax.resource.spi.ConnectionRequestInfo cri)
                                        throws javax.resource.ResourceException
Describe getManagedConnection method here. 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(ConnectionListener cl,
                                    boolean kill)

getConnectionCount

public int getConnectionCount()

allocateConnection

public Object allocateConnection(javax.resource.spi.ManagedConnectionFactory mcf,
                                 javax.resource.spi.ConnectionRequestInfo cri)
                          throws javax.resource.ResourceException
Parameters:
mcf -
cri -
Returns:
Throws:
javax.resource.ResourceException -

transactionStarted

public void transactionStarted(Collection conns)
                        throws SystemException
Specified by:
transactionStarted in interface ConnectionCacheListener
Throws:
SystemException

reconnect

public void reconnect(Collection conns,
                      Set unsharableResources)
               throws javax.resource.ResourceException
Describe reconnect method here.

Specified by:
reconnect in interface ConnectionCacheListener
Parameters:
conns - a Collection value
Throws:
javax.resource.ResourceException - if an error occurs

disconnect

public void disconnect(Collection crs,
                       Set unsharableResources)
                throws javax.resource.ResourceException
Specified by:
disconnect in interface ConnectionCacheListener
Throws:
javax.resource.ResourceException

getNotificationInfo

public javax.management.MBeanNotificationInfo[] getNotificationInfo()
Specified by:
getNotificationInfo in interface javax.management.NotificationBroadcaster
Returns:

unregisterAssociation

protected void unregisterAssociation(ConnectionListener cl,
                                     Object c)
                              throws javax.resource.ResourceException
Throws:
javax.resource.ResourceException

getCcm

protected final CachedConnectionManager getCcm()

managedConnectionReconnected

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

managedConnectionDisconnected

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

isTransactional

public boolean isTransactional()
Description copied from interface: ConnectionListenerFactory
Determine whether is a transaction

Specified by:
isTransactional in interface ConnectionListenerFactory
Returns:
whether there is a transaction

getTransactionManagerInstance

public TransactionManager getTransactionManagerInstance()
Description copied from interface: ConnectionListenerFactory
Get the transaction manager

Specified by:
getTransactionManagerInstance in interface ConnectionListenerFactory
Returns:
the transaction manager


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.