|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jboss.mx.util.JBossNotificationBroadcasterSupport org.jboss.system.ServiceMBeanSupport org.jboss.resource.connectionmanager.BaseConnectionManager2 org.jboss.resource.connectionmanager.TxConnectionManager
The LocalTxConnectionManager is a JBoss ConnectionManager implementation for jca adapters implementing LocalTransaction 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. Created: Fri Sept 6 11:13:28 2002
Nested Class Summary | |
protected class |
TxConnectionManager.TxConnectionEventListener
|
Nested classes inherited from class org.jboss.resource.connectionmanager.BaseConnectionManager2 |
BaseConnectionManager2.BaseConnectionEventListener, BaseConnectionManager2.ConnectionManagerProxy |
Field Summary |
Fields inherited from class org.jboss.resource.connectionmanager.BaseConnectionManager2 |
jndiName, poolingStrategy, STOPPING_NOTIFICATION, trace |
Fields inherited from class org.jboss.system.ServiceMBeanSupport |
log, server, SERVICE_CONTROLLER_SIG, serviceName |
Fields inherited from interface org.jboss.resource.connectionmanager.TxConnectionManagerMBean |
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 | |
TxConnectionManager()
Default managed LocalTxConnectionManager constructor for mbean instances. |
|
TxConnectionManager(CachedConnectionManager ccm,
ManagedConnectionPool poolingStrategy,
TransactionManager tm)
Creates a new TxConnectionManager instance. |
Method Summary | |
ConnectionListener |
createConnectionListener(javax.resource.spi.ManagedConnection mc,
Object context)
Create a managed connection listener for the managed connection |
ConnectionListener |
getManagedConnection(Subject subject,
javax.resource.spi.ConnectionRequestInfo cri)
Describe getManagedConnection method here. |
String |
getTransactionManager()
Deprecated. use the ObjectName TransactionManagerService instead |
TransactionManager |
getTransactionManagerInstance()
Get the transaction manager |
javax.management.ObjectName |
getTransactionManagerService()
mbean get-set pair for field transactionManagerService Get the value of transactionManagerService |
boolean |
isLocalTransactions()
mbean get-set pair for field localTransactions Get the value of localTransactions |
boolean |
isTrackConnectionByTx()
mbean get-set pair for field trackConnectionByTx Get the value of trackConnectionByTx |
boolean |
isTransactional()
Determine whether is a transaction |
protected void |
managedConnectionDisconnected(ConnectionListener cl)
|
protected void |
managedConnectionReconnected(ConnectionListener cl)
|
void |
setLocalTransactions(boolean localTransactions)
Set the value of localTransactions |
void |
setTrackConnectionByTx(boolean trackConnectionByTx)
Set the value of trackConnectionByTx |
void |
setTransactionManager(String tmName)
Deprecated. use the ObjectName TransactionManagerService instead |
void |
setTransactionManagerInstance(TransactionManager tm)
|
void |
setTransactionManagerService(javax.management.ObjectName transactionManagerService)
Set the value of transactionManagerService |
protected void |
startService()
|
protected void |
stopService()
|
void |
transactionStarted(Collection crs)
|
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.resource.connectionmanager.BaseConnectionManager2MBean |
getCachedConnectionManager, getInstance, getJaasSecurityManagerService, getJndiName, getManagedConnectionFactory, getManagedConnectionPool, getSecurityDomainJndiName, setCachedConnectionManager, setJaasSecurityManagerService, setJndiName, setManagedConnectionPool, setSecurityDomainJndiName |
Methods inherited from interface org.jboss.system.ServiceMBean |
getName, getState, getStateString, jbossInternalLifecycle |
Methods inherited from interface org.jboss.system.Service |
create, destroy, start, stop |
Constructor Detail |
public TxConnectionManager()
public TxConnectionManager(CachedConnectionManager ccm, ManagedConnectionPool poolingStrategy, TransactionManager tm)
TxConnectionManager
instance.
for TESTING ONLY!!! not a managed constructor!!
ccm
- a CachedConnectionManager
valuepoolingStrategy
- a ManagedConnectionPool
valuetm
- a TransactionManager
valueMethod Detail |
public javax.management.ObjectName getTransactionManagerService()
getTransactionManagerService
in interface TxConnectionManagerMBean
public void setTransactionManagerService(javax.management.ObjectName transactionManagerService)
setTransactionManagerService
in interface TxConnectionManagerMBean
transactionManagerService
- Value to assign to transactionManagerServicepublic void setTransactionManager(String tmName)
setTransactionManager
in interface TxConnectionManagerMBean
public String getTransactionManager()
getTransactionManager
method here.
getTransactionManager
in interface TxConnectionManagerMBean
String
valuepublic TransactionManager getTransactionManagerInstance()
ConnectionListenerFactory
getTransactionManagerInstance
in interface ConnectionListenerFactory
getTransactionManagerInstance
in class BaseConnectionManager2
public void setTransactionManagerInstance(TransactionManager tm)
public boolean isTrackConnectionByTx()
isTrackConnectionByTx
in interface TxConnectionManagerMBean
public void setTrackConnectionByTx(boolean trackConnectionByTx)
setTrackConnectionByTx
in interface TxConnectionManagerMBean
trackConnectionByTx
- Value to assign to trackConnectionByTxpublic boolean isLocalTransactions()
isLocalTransactions
in interface TxConnectionManagerMBean
public void setLocalTransactions(boolean localTransactions)
setLocalTransactions
in interface TxConnectionManagerMBean
localTransactions
- Value to assign to localTransactionsprotected void startService() throws Exception
startService
in class BaseConnectionManager2
Exception
protected void stopService() throws Exception
stopService
in class BaseConnectionManager2
Exception
public ConnectionListener getManagedConnection(Subject subject, javax.resource.spi.ConnectionRequestInfo cri) throws javax.resource.ResourceException
BaseConnectionManager2
getManagedConnection
method here.
Public for use in testing pooling functionality by itself.
called by both allocateConnection and reconnect.
getManagedConnection
in class BaseConnectionManager2
subject
- a Subject
valuecri
- a ConnectionRequestInfo
value
ManagedConnection
value
javax.resource.ResourceException
- if an error occurspublic void transactionStarted(Collection crs) throws SystemException
transactionStarted
in interface ConnectionCacheListener
transactionStarted
in class BaseConnectionManager2
SystemException
protected void managedConnectionReconnected(ConnectionListener cl) throws javax.resource.ResourceException
managedConnectionReconnected
in class BaseConnectionManager2
javax.resource.ResourceException
protected void managedConnectionDisconnected(ConnectionListener cl) throws javax.resource.ResourceException
managedConnectionDisconnected
in class BaseConnectionManager2
javax.resource.ResourceException
public ConnectionListener createConnectionListener(javax.resource.spi.ManagedConnection mc, Object context) throws javax.resource.ResourceException
ConnectionListenerFactory
createConnectionListener
in interface ConnectionListenerFactory
mc
- the managed connectioncontext
- a context object used by the pool
javax.resource.ResourceException
- for any errorpublic boolean isTransactional()
ConnectionListenerFactory
isTransactional
in interface ConnectionListenerFactory
isTransactional
in class BaseConnectionManager2
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |