That makes sense. I don't know if I can reproduce the problem in a reasonably small test case. I can try, but I currently lack the time.
"oglueck" wrote:
That makes sense. I don't know if I can reproduce the problem in a reasonably small test case. I can try, but I currently lack the time.
// BMT bean
public void recreateRandomRollbackOnly() throws Exception
{
UserTransaction ut = ..
ut.setTransactionTimeout(5); // 5 second timeout
ut.begin();
try
{
try
{
Thread.sleep(10000); // 10 second sleep
}
catch (InterruptedException ignored)
{
}
// Transaction has timed out here
DataSource ds = ...;
ds.getConnection().close(); // Oops can't enlist in dead transaction
}
finally
{
ut.rollback();
}
}
RollbackException - Thrown to indicate that the transaction has been marked for rollback only.
IllegalStateException - Thrown if the transaction in the target object is in the prepared state or the transaction is inactive.