-
1. Re: UserTransactedStartedListener
adrian.brock Oct 1, 2008 8:48 AM (in response to adrian.brock)What I propose to do is add a new registry bean to transaction-service.xml
This will use the MC (un)install callbacks to keep track of UserTransactionStartedListeners
meaning they don't have to be directly configured with a reference to the UTs or the TM.
If they are there, they will be linked together, otherwise they won't.
The new registry will also allow mulitple listeners. Currently the api(s) only allow a singleton.
For now I propose that the registry still has the hardwiring shown above,
but including whatever EJB3 does to register a listener.
A fix to this other side of the api requires more work, e.g.
having the UT suppliers implement some interface such that the MC can
also do (un)install callbacks without the registry having to be pre-coded with a list
of available implementataions. -
2. Re: UserTransactedStartedListener
adrian.brock Oct 1, 2008 8:58 AM (in response to adrian.brock)As an aside there's still one other part of the CCM that needs changing
such that it can work without a TM configured.
This is the code that tries to hand off connection close checking to the
end of the transaction if it exists and hasn't already ended.private CloseConnectionSynchronization getCloseConnectionSynchronization(boolean createIfNotFound) { try { Transaction tx = tm.getTransaction(); if (tx != null) { TransactionSynchronizer.lock(tx); try { CloseConnectionSynchronization cas = (CloseConnectionSynchronization) TransactionSynchronizer.getCCMSynchronization(tx); if (cas == null && createIfNotFound && TxUtils.isActive(tx)) { cas = new CloseConnectionSynchronization(); TransactionSynchronizer.registerCCMSynchronization(tx, cas); } return cas; } finally { TransactionSynchronizer.unlock(tx); } } } catch (Throwable t) { log.debug("Unable to synchronize with transaction", t); } return null; }
This obviously needs some rewrite in the way it works.
i.e. it needs to handle the case where there is no TM
I guess the easiest solution is to have transaction-jboss-beans.xml
inject the TM into the TransactionSynchronizer and then have the CCM
delegate all TM operations to the TransactionSynchronizer.
But this solution has the problem that a JCA implemenation detail is configured
inside the transaction manager config. Although this might be appropriate for
easily removing TM support, it is not appropriate for the opposite case
where the TM is used without JCA.