boolean passed = false;
try
{
UserTransaction ut = UserTransaction.getUserTransaction();
TransactionManager tm = TransactionManager.getTransactionManager();
DemoDurableParticipant p1 = new DemoDurableParticipant();
DemoDurableParticipant p2 = new DemoDurableParticipant();
DemoDurableParticipant p3 = new DemoDurableParticipant();
DemoDurableParticipant p4 = new DemoDurableParticipant();
System.out.println("Starting first transaction.\n");
ut.begin();
tm.enlistForDurableTwoPhase(p1, null);
tm.enlistForDurableTwoPhase(p2, null);
tm.enlistForDurableTwoPhase(p3, null);
tm.enlistForDurableTwoPhase(p4, null);
TxContext ctx = tm.suspend();
System.out.println("Suspended: "+ctx);
ut.begin();
System.out.println("\nStarted second transaction.");
tm.resume(ctx);
System.out.println("\nCommitting first transaction.\n");
ut.commit();