transactionAttribute = this.defaultTransactionAttribute;
}
switch (transactionAttribute) {
case MANDATORY:
if (!this.xoTransaction.isActive()) {
throw new XOException("An active transaction is MANDATORY when calling method '" +
method.getDeclaringClass().getName() + "#" + method.getName() + "'");
}
return context.proceed();
case REQUIRES: {
if (!this.xoTransaction.isActive()) {
try {
this.xoTransaction.begin();
Object result = context.proceed();
this.xoTransaction.commit();
return result;
} catch (RuntimeException e) {
if (this.xoTransaction.isActive()) {
this.xoTransaction.rollback();
}
throw e;
} catch (Exception e) {
if (this.xoTransaction.isActive()) {
this.xoTransaction.commit();
}
throw e;
}
} else {
return context.proceed();
}
}
case NOT_SUPPORTED:
return context.proceed();
default: {
throw new XOException("Unsupported transaction attribute '" + transactionAttribute + "'");
}
}
}