|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jboss.jca.core.connectionmanager.AbstractConnectionManager
org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl
public class TxConnectionManagerImpl

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.
| Field Summary |
|---|
| Fields inherited from class org.jboss.jca.core.connectionmanager.AbstractConnectionManager |
|---|
trace |
| Constructor Summary | |
|---|---|
TxConnectionManagerImpl(org.jboss.jca.core.spi.transaction.TransactionIntegration txIntegration,
boolean localTransactions)
Constructor |
|
| Method Summary | |
|---|---|
ConnectionListener |
createConnectionListener(javax.resource.spi.ManagedConnection mc,
Object context)
Create a managed connection listener for the managed connection. |
boolean |
getIsSameRMOverride()
Get the IsSameRMOverride value |
protected CoreLogger |
getLogger()
Get the logger. |
ConnectionListener |
getManagedConnection(Subject subject,
javax.resource.spi.ConnectionRequestInfo cri)
Public for use in testing pooling functionality by itself. |
boolean |
getPadXid()
Get PadXis status |
long |
getTimeLeftBeforeTransactionTimeout(boolean errorRollback)
Gets time left. |
org.jboss.jca.core.spi.transaction.TransactionIntegration |
getTransactionIntegration()
Get the transaction integration instance |
int |
getTransactionTimeout()
|
boolean |
getWrapXAResource()
Returns true if wrap xa resource. |
int |
getXAResourceTimeout()
Gets XA resource transaction time out. |
boolean |
isInterleaving()
Gets interleaving flag. |
boolean |
isLocalTransactions()
Returns local tx or not. |
boolean |
isTransactional()
Determine whether there connection is a transactional. |
protected void |
managedConnectionDisconnected(ConnectionListener cl)
For polymorphism. |
protected void |
managedConnectionReconnected(ConnectionListener cl)
For polymorphism. |
static void |
rethrowAsSystemException(String context,
Transaction tx,
Throwable t)
RethrowAsSystemException. |
void |
setInterleaving(boolean value)
Sets interleaving flag. |
void |
setIsSameRMOverride(boolean v)
Set the IsSameRMOverride value. |
void |
setPadXid(boolean v)
Set if the Xid should be padded |
void |
setWrapXAResource(boolean v)
Set if the XAResource should be wrapped |
void |
setXAResourceTimeout(int timeout)
Sets XA resource transaction timeout. |
void |
transactionStarted(Collection<ConnectionRecord> crs)
Notification of transaction started |
| 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 |
|---|
getAllocationRetry, getAllocationRetryWaitMillis, getCachedConnectionManager, getJndiName, getPool, getSecurityDomain, getSubjectFactory, setJndiName, shutdown, unregisterAssociation |
| Methods inherited from interface org.jboss.jca.core.api.connectionmanager.ConnectionManager |
|---|
returnManagedConnection |
| Methods inherited from interface javax.resource.spi.ConnectionManager |
|---|
allocateConnection |
| Methods inherited from interface org.jboss.jca.core.connectionmanager.listener.ConnectionCacheListener |
|---|
disconnect, reconnect |
| Constructor Detail |
|---|
public TxConnectionManagerImpl(org.jboss.jca.core.spi.transaction.TransactionIntegration txIntegration,
boolean localTransactions)
txIntegration - The transaction integration layerlocalTransactions - Is local transactions enabled| Method Detail |
|---|
protected CoreLogger getLogger()
getLogger in class AbstractConnectionManagerpublic org.jboss.jca.core.spi.transaction.TransactionIntegration getTransactionIntegration()
getTransactionIntegration in interface ConnectionListenerFactorygetTransactionIntegration in class AbstractConnectionManagerpublic boolean isInterleaving()
isInterleaving in interface TxConnectionManagerpublic void setInterleaving(boolean value)
value - interleavingpublic boolean isLocalTransactions()
isLocalTransactions in interface TxConnectionManagerpublic int getXAResourceTimeout()
getXAResourceTimeout in interface TxConnectionManagerpublic void setXAResourceTimeout(int timeout)
timeout - xa resource transaction timeoutpublic boolean getIsSameRMOverride()
getIsSameRMOverride in interface TxConnectionManagerpublic void setIsSameRMOverride(boolean v)
v - The valuepublic boolean getWrapXAResource()
getWrapXAResource in interface TxConnectionManagerpublic void setWrapXAResource(boolean v)
v - The valuepublic boolean getPadXid()
getPadXid in interface TxConnectionManagerpublic void setPadXid(boolean v)
v - The value
public long getTimeLeftBeforeTransactionTimeout(boolean errorRollback)
throws RollbackException
getTimeLeftBeforeTransactionTimeout in interface org.jboss.jca.core.spi.transaction.TransactionTimeoutConfigurationerrorRollback - error rollback
RollbackException - if exception
public ConnectionListener getManagedConnection(Subject subject,
javax.resource.spi.ConnectionRequestInfo cri)
throws javax.resource.ResourceException
getManagedConnection in class AbstractConnectionManagersubject - a Subject valuecri - a ConnectionRequestInfo value
ManagedConnection value
javax.resource.ResourceException - if an error occurs
public void transactionStarted(Collection<ConnectionRecord> crs)
throws SystemException
transactionStarted in class AbstractConnectionManagercrs - the connections
SystemException - for any error
protected void managedConnectionReconnected(ConnectionListener cl)
throws javax.resource.ResourceException
Do not invoke directly, use reconnectManagedConnection which does the relevent exception handling
managedConnectionReconnected in class AbstractConnectionManagercl - connection listener
javax.resource.ResourceException - for exception
protected void managedConnectionDisconnected(ConnectionListener cl)
throws javax.resource.ResourceException
Do not invoke directly, use disconnectManagedConnection which does the relevent exception handling
managedConnectionDisconnected in class AbstractConnectionManagercl - connection listener
javax.resource.ResourceException - for exception
public ConnectionListener createConnectionListener(javax.resource.spi.ManagedConnection mc,
Object context)
throws javax.resource.ResourceException
createConnectionListener in interface ConnectionListenerFactorymc - the managed connectioncontext - a context object used by the pool
javax.resource.ResourceException - for any errorpublic boolean isTransactional()
isTransactional in interface ConnectionListenerFactoryisTransactional in class AbstractConnectionManager
public int getTransactionTimeout()
throws SystemException
getTransactionTimeout in interface org.jboss.jca.core.spi.transaction.TransactionTimeoutConfigurationSystemException
public static void rethrowAsSystemException(String context,
Transaction tx,
Throwable t)
throws SystemException
context - contexttx - transactiont - throwable
SystemException - system exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||