예제 #1
0
  public <ReturnType> ReturnType inTransaction(
      TransactionIsolationLevel level, TransactionCallback<ReturnType> callback) {
    final TransactionIsolationLevel initial = getTransactionIsolationLevel();
    boolean failed = true;
    try {
      setTransactionIsolation(level);

      ReturnType result = transactions.inTransaction(this, level, callback);
      failed = false;

      return result;
    } finally {
      try {
        setTransactionIsolation(initial);
      } catch (RuntimeException e) {
        if (!failed) {
          throw e;
        }

        // Ignore, there was already an exceptional condition and we don't want to clobber it.
      }
    }
  }
예제 #2
0
 public <ReturnType> ReturnType inTransaction(TransactionCallback<ReturnType> callback) {
   return transactions.inTransaction(this, callback);
 }