Пример #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 void setTransactionIsolation(TransactionIsolationLevel level) {
   setTransactionIsolation(level.intValue());
 }