Esempio n. 1
0
  public int cancel() {
    int outcome = super.cancel();

    /*
     * Now remove this thread from the reaper. Leave
     * the thread-to-tx association though.
     */

    TransactionReaper.transactionReaper().remove(this);

    return outcome;
  }
Esempio n. 2
0
  public int end(boolean report_heuristics) {
    int outcome = super.end(report_heuristics);

    /*
     * Now remove this thread from the reaper. Leave
     * the thread-to-tx association though.
     */

    TransactionReaper.transactionReaper().remove(this);

    return outcome;
  }
Esempio n. 3
0
  /**
   * Commit the transaction. The report_heuristics parameter can be used to determine whether or not
   * heuristic outcomes are reported.
   *
   * <p>If the transaction has already terminated, or has not begun, then an appropriate error code
   * will be returned.
   *
   * @return <code>ActionStatus</code> indicating outcome.
   */
  public int commit(boolean report_heuristics) {
    int status = super.end(report_heuristics);

    /*
     * Now remove this thread from the action state.
     */

    ThreadActionData.popAction();

    TransactionReaper.transactionReaper().remove(this);

    return status;
  }
Esempio n. 4
0
  /**
   * Abort (rollback) the transaction.
   *
   * <p>If the transaction has already terminated, or has not been begun, then an appropriate error
   * code will be returned.
   *
   * @return <code>ActionStatus</code> indicating outcome.
   */
  public int abort() {
    int status = super.cancel();

    /*
     * Now remove this thread from the action state.
     */

    ThreadActionData.popAction();

    TransactionReaper.transactionReaper().remove(this);

    return status;
  }
Esempio n. 5
0
  /**
   * Start the transaction running.
   *
   * <p>If the transaction is already running or has terminated, then an error code will be
   * returned.
   *
   * @param timeout the timeout associated with the transaction. If the transaction is still active
   *     when this timeout elapses, the system will automatically roll it back.
   * @return <code>ActionStatus</code> indicating outcome.
   */
  public int begin(int timeout) {
    int status = super.start();

    if (status == ActionStatus.RUNNING) {
      /*
       * Now do thread/action tracking.
       */

      ThreadActionData.pushAction(this);

      _timeout = timeout;

      if (_timeout == 0) _timeout = TxControl.getDefaultTimeout();

      if (_timeout > 0) TransactionReaper.transactionReaper().insert(this, _timeout);
    }

    return status;
  }