try
{
for (index = 0; index < numberOfCalls; index++)
{
AtomicTransaction atomicTransaction = new AtomicTransaction();
atomicTransaction.begin();
counter.increase(OTS.current().get_control());
atomicTransaction.commit(true);
}
}
catch (org.omg.CORBA.TRANSACTION_ROLLEDBACK e)
{
/*
* If the number of transactions created is equal to the
* expected result then we are not expecting this exception
* to be thrown therefore the test has failed
*/
System.err.println("Performed " + index + " calls when exception thrown");
if (!expectingFailure)
{
System.err.println("Got unexpected org.omg.CORBA.TRANSACTION_ROLLEDBACK exception");
throw e;
}
else
{
System.err.println("Got expected org.omg.CORBA.TRANSACTION_ROLLEDBACK exception");
}
}
catch (Exception e)
{
System.err.println("Performed " + index + " calls when exception thrown");
throw e;
}
AtomicTransaction atomicTransaction = new AtomicTransaction();
atomicTransaction.begin();
IntHolder value = new IntHolder();
counter.get(value, OTS.current().get_control());
try
{
atomicTransaction.commit(true);
}
catch (org.omg.CORBA.TRANSACTION_ROLLEDBACK e)
{
if (!expectingFailure)
{