public void abort()

in tephra-core/src/main/java/org/apache/tephra/TransactionContext.java [227:269]


  public void abort(TransactionFailureException cause) throws TransactionFailureException {
    if (currentTx == null) {
      // might be called by some generic exception handler even though already aborted/finished - we allow that
      return;
    }
    try {
      boolean success = true;
      for (TransactionAware txAware : txAwares) {
        try {
          success = txAware.rollbackTx() && success;
        } catch (Throwable t) {
          TransactionFailureException tfe = createTransactionFailure("roll back changes in", txAware, t);
          LOG.warn(tfe.getMessage());
          if (cause == null) {
            cause = tfe;
          } else {
            cause.addSuppressed(tfe);
          }
          success = false;
        }
      }
      try {
        if (success) {
          txClient.abort(currentTx);
        } else {
          txClient.invalidate(currentTx.getTransactionId());
        }
      } catch (Throwable t) {
        if (cause == null) {
          cause = new TransactionFailureException(
            String.format("Error while calling transaction service to %s transaction %d.",
                          success ? "abort" : "invalidate", currentTx.getTransactionId()));
        } else {
          cause.addSuppressed(t);
        }
      }
      if (cause != null) {
        throw cause;
      }
    } finally {
      currentTx = null;
    }
  }