try
{
if ((out.completedStatus().equals(Failure.instance()) ||
out.completedStatus().equals(FailureOnly.instance())) && commit)
{
throw new TransactionRolledBackException();
}
}
catch (SystemException ex)
{
throw new HeuristicHazardException();
}
if (out instanceof CoordinationOutcome)
{
int res = ((CoordinationOutcome) out).result();
switch (res)
{
case TwoPhaseResult.CANCELLED:
case TwoPhaseResult.HEURISTIC_CANCEL:
{
if (commit)
throw new TransactionRolledBackException();
}
break;
case TwoPhaseResult.CONFIRMED:
case TwoPhaseResult.HEURISTIC_CONFIRM:
{