コード例 #1
0
ファイル: AtomicAction.java プロジェクト: radeshrao/narayana
  /**
   * 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;
  }