in taverna-server-webapp/src/main/java/org/apache/taverna/server/master/utils/JDOSupport.java [191:226]
Object applyTransaction(ProceedingJoinPoint pjp, JDOSupport<?> support)
throws Throwable {
synchronized (lock) {
PersistenceManager pm = support.pm();
int id = ++txid;
Transaction tx = (pm == null) ? null : pm.currentTransaction();
if (tx != null && tx.isActive())
tx = null;
if (tx != null) {
if (log.isDebugEnabled())
log.debug("starting transaction #" + id);
tx.begin();
}
try {
Object result = pjp.proceed();
if (tx != null) {
tx.commit();
if (log.isDebugEnabled())
log.debug("committed transaction #" + id);
}
tx = null;
return result;
} catch (Throwable t) {
try {
if (tx != null) {
tx.rollback();
if (log.isDebugEnabled())
log.debug("rolled back transaction #" + id);
}
} catch (JDOException e) {
log.warn("rollback failed unexpectedly", e);
}
throw t;
}
}
}