return tx;
}
private boolean crashTest(ASFailureSpec[] sa, String testEntityPK, boolean reverseOrder) throws Exception
{
UserTransaction tx = null;
try
{
CrashRem cr = lookupCrashBean(isCMT ? CrashRem.CMT_JNDI_NAME : CrashRem.BMT_JNDI_NAME);
if (clientTx)
tx = startTx();
String res = cr.testXA(testEntityPK, reverseOrder, sa);
return "Passed".equalsIgnoreCase(res);
}
catch (CannotConnectException e)
{
if (expectFailure)
{
print("Failure was expected: " + e.getMessage());
return recoverUids();
}
else
{
System.err.println("XACrashTest:crashTest: Caught[1] " + e);
e.printStackTrace();
}
}
catch (EJBTransactionRolledbackException re)
{
// try to recover, this failure was expected maybe?!
print("Failure was expected (maybe): " + re.getMessage());
return recoverUids();
}
catch (RuntimeException re)
{
if (re.getCause() instanceof HeuristicMixedException)
{
// try to recover, this failure was expected maybe?!
print("Failure was expected (maybe): " + re.getMessage());
return recoverUids();
}
else
{
System.err.println("XACrashTest:crashTest: Caught[2] " + re);
re.printStackTrace();
}
}
catch (Throwable t)
{
t.printStackTrace();
System.err.println("XACrashTest:crashTest: Caught[3] " + t);
}
finally {
if (clientTx)
try
{
tx.commit();
}
catch (Throwable e)
{
System.out.println("User tx commit failure: " + e.getMessage());
}