if (managedEnv) {
logger.log(BasicLevel.INFO, ".");
String tmName = ((JDOPOManagerItf) pm).getPersistenceManagerFactory().getProperties()
.getProperty(SpeedoProperties.TM_NAME);
if (tmName == null) {
return new JDOFatalException("No transaction manager jndi name found in initialisation properties");
}
try {
Object o = new InitialContext().lookup(tmName);
if (o == null) {
String msg = "The transaction must be marked as rollbackOnly: JNDI retrieves a null transaction manager for the name '" + tmName + "'.";
logger.log(BasicLevel.ERROR, msg);
return new JDOFatalException(msg);
}
if (!(o instanceof TransactionManager)) {
String msg = "The transaction must be marked as rollbackOnly: JNDI retrieves an object which is not a javax.transaction.TransactionManager (JNDI name: " + tmName + "): " + o;
logger.log(BasicLevel.ERROR, msg);
return new JDOFatalException(msg);
}
javax.transaction.Transaction t = ((TransactionManager) o).getTransaction();
if (t == null) {
String msg = "Impossible to rollback an unexisting transaction (TM.getTransaction()=null)";
logger.log(BasicLevel.ERROR, msg);
return new JDOFatalException(msg);
}
t.setRollbackOnly();
} catch (Exception e) {
String msg = "The transaction must be marked as rollbackOnly: Error when lookup the transaction manager in JNDI with the name '"
+ tmName + "'";
logger.log(BasicLevel.ERROR, msg, e);
return new JDOFatalException(msg);
}
} else {
rollback();
}
return new JDOFatalException("The current transaction has been rolledback, please retry", ie);
} else {
return new JDOFatalException("The current working set occrurs an error, please retry", ie);
}
}