{
com.arjuna.ats.jts.ExplicitInterposition interposition = new com.arjuna.ats.jts.ExplicitInterposition();
interposition.registerTransaction(ctrl);
AtomicTransaction atomicTransaction = new AtomicTransaction();
try
{
atomicTransaction.begin();
if (count != 0)
{
ponger.bad_hit(count - 1, bad_count - 1, pinger, ponger, OTS.current().get_control());
if (bad_count != 0)
{
atomicTransaction.commit(true);
}
else
{
atomicTransaction.rollback();
}
}
else if (setlock(new Lock(LockMode.WRITE), 0) == LockResult.GRANTED)
{
_value++;
if (bad_count != 0)
{
atomicTransaction.commit(true);
}
else
{
atomicTransaction.rollback();
}
}
else
{
System.err.println("AITPingPongImpl01.bad_hit: failed to get lock");
atomicTransaction.rollback();
throw new InvocationException();
}
}
catch (InvocationException invocationException)
{
interposition.unregisterTransaction();
throw invocationException;
}
catch (Exception exception)
{
System.err.println("AITPingPongImpl01.bad_hit: " + exception);
if (atomicTransaction.get_status() == Status.StatusActive)
{
atomicTransaction.rollback();
}
interposition.unregisterTransaction();
throw new InvocationException();
}
catch (Error error)
{
System.err.println("AITPingPongImpl01.bad_hit: " + error);
if (atomicTransaction.get_status() == Status.StatusActive)
{
atomicTransaction.rollback();
}
interposition.unregisterTransaction();
throw new InvocationException();