{
ConnectionListener cl = null;
try
{
if (tm == null)
throw new SystemException("TM is null");
tm.begin();
long startGetConnection = System.currentTimeMillis();
cl = cm.getManagedConnection(subject, cri);
cl.enlist();
long endGetConnection = System.currentTimeMillis();
TxConnectionManagerStressTestCase.this.connectionCount.incrementAndGet();
Thread.sleep(sleepTime);
if (tm == null)
throw new SystemException("TM is null");
tm.commit();
long startReturnConnection = System.currentTimeMillis();
if (!trackByTx)
{
cl.delist();
cm.returnManagedConnection(cl, false);
}
cl = null;
long endReturnConnection = System.currentTimeMillis();
duration += (endReturnConnection - startGetConnection);
getConnection += (endGetConnection - startGetConnection);
returnConnection += (endReturnConnection - startReturnConnection);
heldConnection += (startReturnConnection - endGetConnection);
}
catch (NotSupportedException nse)
{
TxConnectionManagerStressTestCase.this.log.info("error: iterationCount: " + j + ", connectionCount: " + TxConnectionManagerStressTestCase.this.connectionCount.get() + " " + nse.getMessage());
TxConnectionManagerStressTestCase.this.errorCount.incrementAndGet();
TxConnectionManagerStressTestCase.this.error = nse;
TxConnectionManagerStressTestCase.this.failed = true;
}
catch (SystemException se)
{
TxConnectionManagerStressTestCase.this.log.info("error: iterationCount: " + j + ", connectionCount: " + TxConnectionManagerStressTestCase.this.connectionCount.get() + " " + se.getMessage());
TxConnectionManagerStressTestCase.this.errorCount.incrementAndGet();
TxConnectionManagerStressTestCase.this.error = se;
TxConnectionManagerStressTestCase.this.failed = true;
}
catch (RollbackException rbe)
{
TxConnectionManagerStressTestCase.this.log.info("error: iterationCount: " + j + ", connectionCount: " + TxConnectionManagerStressTestCase.this.connectionCount.get() + " " + rbe.getMessage());
TxConnectionManagerStressTestCase.this.errorCount.incrementAndGet();
TxConnectionManagerStressTestCase.this.error = rbe;
TxConnectionManagerStressTestCase.this.failed = true;
}
catch (HeuristicMixedException hme)
{
TxConnectionManagerStressTestCase.this.log.info("error: iterationCount: " + j + ", connectionCount: " + TxConnectionManagerStressTestCase.this.connectionCount.get() + " " + hme.getMessage());
TxConnectionManagerStressTestCase.this.errorCount.incrementAndGet();
TxConnectionManagerStressTestCase.this.error = hme;
TxConnectionManagerStressTestCase.this.failed = true;
}
catch (HeuristicRollbackException hre)
{
TxConnectionManagerStressTestCase.this.log.info("error: iterationCount: " + j + ", connectionCount: " + TxConnectionManagerStressTestCase.this.connectionCount.get() + " " + hre.getMessage());
TxConnectionManagerStressTestCase.this.errorCount.incrementAndGet();
TxConnectionManagerStressTestCase.this.error = hre;
TxConnectionManagerStressTestCase.this.failed = true;
}
catch (ResourceException re)
{
TxConnectionManagerStressTestCase.this.log.info("error: iterationCount: " + j + ", connectionCount: " + TxConnectionManagerStressTestCase.this.connectionCount.get() + " " + re.getMessage());
TxConnectionManagerStressTestCase.this.errorCount.incrementAndGet();
TxConnectionManagerStressTestCase.this.error = re;
TxConnectionManagerStressTestCase.this.failed = true;
}
catch (InterruptedException ie)
{
break;
}
finally
{
if (cl != null)
cm.returnManagedConnection(cl, true);
try
{
if (tm == null)
throw new SystemException("TM is null");
Transaction tx = tm.getTransaction();
if (tx != null)
log.info("TX STATUS=" + TxUtils.getStatusAsString(tx.getStatus()));
if (tx != null && TxUtils.isUncommitted(tx))