txTable = cache.getTransactionTable();
}
public Object invoke(MethodCall call) throws Throwable
{
JBCMethodCall m = (JBCMethodCall) call;
if (log.isTraceEnabled())
{
log.trace("("+cache.getLocalAddress()+") call on method [" + m + "]");
}
// bypass for buddy group org metod calls.
if (isBuddyGroupOrganisationMethod(m)) return super.invoke(m);
InvocationContext ctx = getInvocationContext();
final Transaction suspendedTransaction;
boolean scrubTxsOnExit = false;
final boolean resumeSuspended;
Option optionOverride = ctx.getOptionOverrides();
setTransactionInContext(ctx, txManager);
if (optionOverride!= null && optionOverride.isFailSilently() && ctx.getTransaction() != null)
{
// make sure we remove the tx and global tx from the transaction table, since we don't care about this transaction
// and will just suspend it. - JBCACHE-1246
GlobalTransaction gtx = txTable.remove(ctx.getTransaction());
if (gtx != null) txTable.remove(gtx);
suspendedTransaction = txManager.suspend();
// set the tx in the invocation context to null now! - JBCACHE-785
ctx.setTransaction(null);
ctx.setGlobalTransaction(null);
resumeSuspended = true;
} else {
suspendedTransaction = null;
resumeSuspended = false;
}
Object result = null;
try
{
// first of all deal with tx methods - these are only going to be
// prepare/commit/rollback called by a remote cache, since calling
// such methods on TreeCache directly would fail.
if (isTransactionLifecycleMethod(m))
{
// this is a prepare, commit, or rollback.
// start by setting transactional details into InvocationContext.
ctx.setGlobalTransaction( findGlobalTransaction(m.getArgs()) );
if (log.isDebugEnabled()) log.debug("Got gtx from method call " + ctx.getGlobalTransaction());
ctx.getGlobalTransaction().setRemote( isRemoteGlobalTx(ctx.getGlobalTransaction()) );
//replaceGtx(m, gtxFromMethodCall);
if (ctx.getGlobalTransaction().isRemote()) remoteTransactions.put(ctx.getGlobalTransaction(),NULL);
switch (m.getMethodId())
{
case MethodDeclarations.optimisticPrepareMethod_id:
case MethodDeclarations.prepareMethod_id:
if (ctx.getGlobalTransaction().isRemote())
{