Save This Page
Home » JBoss-5.1.0 » org » jboss » resource » connectionmanager » [javadoc | source]
org.jboss.resource.connectionmanager
public class: TxConnectionManager [javadoc | source]
java.lang.Object
   org.jboss.mx.util.JBossNotificationBroadcasterSupport
      org.jboss.system.ServiceMBeanSupport
         org.jboss.resource.connectionmanager.BaseConnectionManager2
            org.jboss.resource.connectionmanager.TxConnectionManager

All Implemented Interfaces:
    TxConnectionManagerMBean, BaseConnectionManager2MBean, TransactionTimeoutConfiguration, JTATransactionChecker, ConnectionListenerFactory, ConnectionCacheListener, KernelControllerContextAware, ServiceMBean, MBeanRegistration, NotificationEmitter

Direct Known Subclasses:
    LocalTxConnectionManager, XATxConnectionManager

The TxConnectionManager is a JBoss ConnectionManager implementation for jca adapters implementing LocalTransaction and XAResource support. It implements a ConnectionEventListener that implements XAResource to manage transactions through the Transaction Manager. To assure that all work in a local transaction occurs over the same ManagedConnection, it includes a xid to ManagedConnection map. When a Connection is requested or a transaction started with a connection handle in use, it checks to see if a ManagedConnection already exists enrolled in the global transaction and uses it if found. Otherwise a free ManagedConnection has its LocalTransaction started and is used. From the BaseConnectionManager2, 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. This connection manager has to perform the following operations: 1. When an application component requests a new ConnectionHandle, it must find a ManagedConnection, and make sure a ConnectionEventListener is registered. It must inform the CachedConnectionManager that a connection handle has been given out. It needs to count the number of handles for each ManagedConnection. If there is a current transaction, it must enlist the ManagedConnection's LocalTransaction in the transaction using the ConnectionEventListeners XAResource XAResource implementation. Entry point: ConnectionManager.allocateConnection. written. 2. When a ConnectionClosed event is received from the ConnectionEventListener, it must reduce the handle count. If the handle count is zero, the XAResource should be delisted from the Transaction, if any. The CachedConnectionManager must be notified that the connection is closed. Entry point: ConnectionEventListener.ConnectionClosed. written 3. When a transaction begun notification is received from the UserTransaction (via the CachedConnectionManager, all managedConnections associated with the current object must be enlisted in the transaction. Entry point: (from CachedConnectionManager) ConnectionCacheListener.transactionStarted(Transaction, Collection). The collection is of ConnectionRecord objects. written. 5. When an "entering object" notification is received from the CachedConnectionInterceptor, all the connections for the current object must be associated with a ManagedConnection. if there is a Transaction, the XAResource must be enlisted with it. Entry point: ConnectionCacheListener.reconnect(Collection conns) The Collection is of ConnectionRecord objects. written. 6. When a "leaving object" notification is received from the CachedConnectionInterceptor, all the managedConnections for the current object must have their XAResources delisted from the current Transaction, if any, and cleanup called on each ManagedConnection. Entry point: ConnectionCacheListener.disconnect(Collection conns). written.
Nested Class Summary:
protected class  TxConnectionManager.TxConnectionEventListener   
Fields inherited from org.jboss.resource.connectionmanager.BaseConnectionManager2:
STOPPING_NOTIFICATION,  managedConnectionPoolName,  poolingStrategy,  jndiName,  securityDomainJndiName,  subjectFactory,  jaasSecurityManagerService,  ccmName,  ccm,  trace,  allocationRetry,  allocationRetryWaitMillis,  shutdown
Fields inherited from org.jboss.system.ServiceMBeanSupport:
SERVICE_CONTROLLER_SIG,  log,  server,  serviceName
Constructor:
 public TxConnectionManager() 
 public TxConnectionManager(CachedConnectionManager ccm,
    ManagedConnectionPool poolingStrategy,
    TransactionManager tm) 
    Creates a new TxConnectionManager instance. for TESTING ONLY!!! not a managed constructor!!
    Parameters:
    ccm - a CachedConnectionManager value
    poolingStrategy - a ManagedConnectionPool value
    tm - a TransactionManager value
Method from org.jboss.resource.connectionmanager.TxConnectionManager Summary:
checkTransactionActive,   createConnectionListener,   getIsSameRMOverrideValue,   getManagedConnection,   getPadXid,   getTimeLeftBeforeTransactionTimeout,   getTransactionManager,   getTransactionManagerInstance,   getTransactionManagerService,   getWrapXAResource,   getXAResourceTransactionTimeout,   isInterleaving,   isLocalTransactions,   isTrackConnectionByTx,   isTransactional,   managedConnectionDisconnected,   managedConnectionReconnected,   rethrowAsSystemException,   setInterleaving,   setIsSameRMOverrideValue,   setLocalTransactions,   setPadXid,   setTrackConnectionByTx,   setTransactionManager,   setTransactionManagerInstance,   setTransactionManagerService,   setWrapXAResource,   setXAResourceTransactionTimeout,   startService,   stopService,   transactionStarted
Methods from org.jboss.resource.connectionmanager.BaseConnectionManager2:
allocateConnection,   checkTransactionActive,   disconnect,   disconnectManagedConnection,   getAllocationRetry,   getAllocationRetryWaitMillis,   getCachedConnectionManager,   getCcm,   getConnectionCount,   getInstance,   getJaasSecurityManagerService,   getJndiName,   getManagedConnection,   getManagedConnection,   getManagedConnectionFactory,   getManagedConnectionPool,   getNotificationInfo,   getPoolingStrategy,   getSecurityDomainJndiName,   getSubjectFactory,   getTimeLeftBeforeTransactionTimeout,   getTransactionManagerInstance,   getTransactionTimeout,   isTransactional,   managedConnectionDisconnected,   managedConnectionReconnected,   reconnect,   reconnectManagedConnection,   rethrowAsResourceException,   returnManagedConnection,   setAllocationRetry,   setAllocationRetryWaitMillis,   setCachedConnectionManager,   setJaasSecurityManagerService,   setJndiName,   setManagedConnectionPool,   setSecurityDomainJndiName,   setSubjectFactory,   startService,   stopService,   transactionStarted,   unregisterAssociation
Methods from org.jboss.system.ServiceMBeanSupport:
create,   createService,   destroy,   destroyService,   getDeploymentInfo,   getLog,   getName,   getNextNotificationSequenceNumber,   getObjectName,   getServer,   getServiceName,   getState,   getStateString,   jbossInternalCreate,   jbossInternalDescription,   jbossInternalDestroy,   jbossInternalLifecycle,   jbossInternalStart,   jbossInternalStop,   pojoChange,   pojoCreate,   pojoDestroy,   pojoStart,   pojoStop,   postDeregister,   postRegister,   preDeregister,   preRegister,   setKernelControllerContext,   start,   startService,   stop,   stopService,   unsetKernelControllerContext
Methods from org.jboss.mx.util.JBossNotificationBroadcasterSupport:
addNotificationListener,   getNotificationInfo,   handleNotification,   nextNotificationSequenceNumber,   removeNotificationListener,   removeNotificationListener,   sendNotification
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.jboss.resource.connectionmanager.TxConnectionManager Detail:
 public  void checkTransactionActive() throws RollbackException, SystemException 
 public ConnectionListener createConnectionListener(ManagedConnection mc,
    Object context) throws ResourceException 
 public Boolean getIsSameRMOverrideValue() 
    Get the IsSameRMOverrideValue value.
 public ConnectionListener getManagedConnection(Subject subject,
    ConnectionRequestInfo cri) throws ResourceException 
 public boolean getPadXid() 
 public long getTimeLeftBeforeTransactionTimeout(boolean errorRollback) throws RollbackException 
 public String getTransactionManager() 
Deprecated!
 public TransactionManager getTransactionManagerInstance() 
 public ObjectName getTransactionManagerService() 
 public boolean getWrapXAResource() 
 public int getXAResourceTransactionTimeout() 
 public boolean isInterleaving() 
 public boolean isLocalTransactions() 
 public boolean isTrackConnectionByTx() 
 public boolean isTransactional() 
 protected  void managedConnectionDisconnected(ConnectionListener cl) throws ResourceException 
 protected  void managedConnectionReconnected(ConnectionListener cl) throws ResourceException 
 protected static  void rethrowAsSystemException(String context,
    Transaction tx,
    Throwable t) throws SystemException 
 public  void setInterleaving(boolean value) 
 public  void setIsSameRMOverrideValue(Boolean isSameRMOverrideValue) 
    Set the IsSameRMOverrideValue value.
 public  void setLocalTransactions(boolean localTransactions) 
 public  void setPadXid(boolean padXid) 
 public  void setTrackConnectionByTx(boolean trackConnectionByTx) 
 public  void setTransactionManager(String tmName) 
Deprecated!
 public  void setTransactionManagerInstance(TransactionManager tm) 
 public  void setTransactionManagerService(ObjectName transactionManagerService) 
 public  void setWrapXAResource(boolean useXAWrapper) 
 public  void setXAResourceTransactionTimeout(int timeout) 
 protected  void startService() throws Exception 
 protected  void stopService() throws Exception 
 public  void transactionStarted(Collection crs) throws SystemException