I think the way this does is pretty bad.
It requires each UserTransaction to implement a static method
to inject the transaction started listener
| //Registration for CachedConnectionManager so our UserTx can notify
| //on tx started.
| private static ServerVMClientUserTransaction.UserTransactionStartedListener tsl;
|
| /**
| * The <code>setUserTransactionStartedListener</code> method is called
by
| * CachedConnectionManager on start and stop. The tsl is notified on
| * UserTransaction.begin so it (the CachedConnectionManager) can enroll
| * connections that are already checked out.
| *
| * @param newTsl a
<code>ServerVMClientUserTransaction.UserTransactionStartedListener</code>
value
| */
| public static void
setUserTransactionStartedListener(ServerVMClientUserTransaction.UserTransactionStartedListener
newTsl)
| {
| tsl = newTsl;
| }
|
Then the cached connection manager (CCM) needs to know about all listeners:
|
| protected void startService()
| throws Exception
| {
| tm = (TransactionManager)
getServer().getAttribute(transactionManagerServiceName,
| "TransactionManager");
| TransactionSynchronizer.setTransactionManager(tm);
| ServerVMClientUserTransaction.getSingleton().registerTxStartedListener(this);
| EnterpriseContext.setUserTransactionStartedListener(this);
| }
|
It would be much better if the CCM had a single place to register the listener
and then each UserTransaction notified that single place of transaction start.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4059563#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...