Methods Summary |
---|
synchronized void | addEnlisted(javax.transaction.Synchronization synch)The synchronization is now enlisted
if (enlisted == null)
enlisted = new ArrayList();
enlisted.add(synch);
|
synchronized void | addUnenlisted(javax.transaction.Synchronization synch)Add a new Tx synchronization that has not been enlisted
if (unenlisted == null)
unenlisted = new ArrayList();
unenlisted.add(synch);
|
public void | afterCompletion(int status)
if (enlisted != null)
{
int i = 0;
while (i < enlisted.size())
{
Synchronization synch = (Synchronization) enlisted.get(i);
invokeAfter(synch, status);
++i;
}
}
if (ccmSynch != null)
invokeAfter(ccmSynch, status);
|
public void | beforeCompletion()
if (enlisted != null)
{
int i = 0;
while (i < enlisted.size())
{
Synchronization synch = (Synchronization) enlisted.get(i);
invokeBefore(synch);
++i;
}
}
if (ccmSynch != null)
invokeBefore(ccmSynch);
|
synchronized void | enlisted()This thread has finished enlisting
Thread currentThread = Thread.currentThread();
if (enlistingThread == null || enlistingThread != currentThread)
{
log.warn("Thread " + currentThread + " not the enlisting thread " + enlistingThread, new Exception("STACKTRACE"));
return;
}
enlistingThread = null;
notifyAll();
|
static javax.transaction.Synchronization | getCCMSynchronization(javax.transaction.Transaction tx)Check whether we have a CCM synchronization
TransactionSynchronizer ts = (TransactionSynchronizer) txSynchs.get(tx);
if (ts != null)
return ts.ccmSynch;
else
return null;
|
static org.jboss.resource.connectionmanager.TransactionSynchronizer | getRegisteredSynchronizer(javax.transaction.Transaction tx)Get a registered transaction synchronizer.
TransactionSynchronizer result = (TransactionSynchronizer) txSynchs.get(tx);
if (result == null)
{
result = new TransactionSynchronizer(tx);
tx.registerSynchronization(result);
txSynchs.set(tx, result);
}
return result;
|
synchronized java.util.ArrayList | getUnenlisted()Get the unenlisted synchronizations
and say we are enlisting if some are returned.
Thread currentThread = Thread.currentThread();
while (enlistingThread != null && enlistingThread != currentThread)
{
boolean interrupted = false;
try
{
wait();
}
catch (InterruptedException e)
{
interrupted = true;
}
if (interrupted)
currentThread.interrupt();
}
ArrayList result = unenlisted;
unenlisted = null;
if (result != null)
enlistingThread = currentThread;
return result;
|
protected void | invokeAfter(javax.transaction.Synchronization synch, int status)Invoke an afterCompletion
try
{
synch.afterCompletion(status);
}
catch (Throwable t)
{
log.warn("Transaction " + tx + " error in after completion " + synch, t);
}
|
protected void | invokeBefore(javax.transaction.Synchronization synch)Invoke a beforeCompletion
try
{
synch.beforeCompletion();
}
catch (Throwable t)
{
log.warn("Transaction " + tx + " error in before completion " + synch, t);
}
|
static void | lock(javax.transaction.Transaction tx)Lock for the given transaction
try
{
txSynchs.lock(tx);
}
catch (InterruptedException e)
{
throw new NestedRuntimeException("Unable to get synchronization", e);
}
|
static void | registerCCMSynchronization(javax.transaction.Transaction tx, javax.transaction.Synchronization synch)Register a new CCM synchronization
TransactionSynchronizer ts = getRegisteredSynchronizer(tx);
ts.ccmSynch = synch;
|
synchronized boolean | removeEnlisted(javax.transaction.Synchronization synch)Remove an enlisted synchronization
return enlisted.remove(synch);
|
public static void | setTransactionManager(javax.transaction.TransactionManager tm)Initialization
txSynchs = new TransactionLocal(tm);
|
static void | unlock(javax.transaction.Transaction tx)Unlock for the given transaction
txSynchs.unlock(tx);
|