* @throws Throwable
*/
protected Object runPreparePhase(InvocationContext ctx, GlobalTransaction gtx, List modifications) throws Throwable
{
// build the method call
MethodCall prepareMethod;
// if (cache.getCacheModeInternal() != CacheImpl.REPL_ASYNC)
// {
// running a 2-phase commit.
if (configuration.isNodeLockingOptimistic())
{
prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod_id, gtx, modifications, null, cache.getLocalAddress(), false);
}
else if (configuration.getCacheMode() != Configuration.CacheMode.REPL_ASYNC)
{
prepareMethod = MethodCallFactory.create(MethodDeclarations.prepareMethod_id,
gtx, modifications, cache.getLocalAddress(),
false);// don't commit or rollback - wait for call
}
//}
else
{
// this is a REPL_ASYNC call - do 1-phase commit. break!
if (trace) log.trace("This is a REPL_ASYNC call (1 phase commit) - do nothing for beforeCompletion()");
return null;
}
// passes a prepare call up the local interceptor chain. The replication interceptor
// will do the broadcasting if needed. This is so all requests (local/remote) are
// treated the same
Object result;
// Is there a local transaction associated with GTX ?
Transaction ltx = ctx.getTransaction();
//if ltx is not null and it is already running
if (txManager.getTransaction() != null && ltx != null && txManager.getTransaction().equals(ltx))
{
MethodCall originalCall = ctx.getMethodCall();
ctx.setMethodCall(prepareMethod);
try
{
result = nextInterceptor(ctx);
}