{
public static void testMultiParticipants()
throws Exception
{
UserTransaction ut = UserTransaction.getUserTransaction();
TransactionManager tm = TransactionManager.getTransactionManager();
DemoDurableParticipant p1 = new DemoDurableParticipant();
DemoDurableParticipant p2 = new DemoDurableParticipant();
DemoDurableParticipant p3 = new DemoDurableParticipant();
DemoDurableParticipant p4 = new DemoDurableParticipant();
ut.begin();
try {
tm.enlistForDurableTwoPhase(p1, p1.identifier());
tm.enlistForDurableTwoPhase(p2, p2.identifier());
tm.enlistForDurableTwoPhase(p3, p3.identifier());
tm.enlistForDurableTwoPhase(p4, p4.identifier());
} catch (Exception eouter) {
try {
ut.rollback();
} catch(Exception einner) {
}
throw eouter;
}
ut.commit();
}