Example #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;
  }
Example #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;
  }
Example #3
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;
  }
Example #4
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;
  }
  @Override
  @After
  public void tearDown() throws Exception {
    Iterator<ServerGroup> iter = groups.values().iterator();
    while (iter.hasNext()) {
      iter.next().stop();
    }

    TxControl.disable(true);

    TransactionReaper.terminate(false);

    super.tearDown();
  }
Example #6
0
  @Override
  @After
  public void tearDown() throws Exception {
    checkEmpty(sourceQueue, 0);
    checkEmpty(localTargetQueue, 0);
    checkEmpty(targetQueue, 1);

    // Check no subscriptions left lying around

    checkNoSubscriptions(sourceTopic, 0);
    if (cff0 instanceof HornetQConnectionFactory) {
      ((HornetQConnectionFactory) cff0).close();
    }
    if (cff1 instanceof HornetQConnectionFactory) {
      ((HornetQConnectionFactory) cff1).close();
    }
    stopComponent(jmsServer0);
    stopComponent(jmsServer1);
    cff0 = cff1 = null;
    cff0xa = cff1xa = null;

    cf0 = cf1 = null;

    cf0xa = cf1xa = null;

    sourceQueueFactory = targetQueueFactory = localTargetQueueFactory = sourceTopicFactory = null;

    sourceQueue = targetQueue = localTargetQueue = null;

    sourceTopic = null;

    server0 = null;

    jmsServer0 = null;

    server1 = null;

    jmsServer1 = null;
    if (context0 != null) context0.close();
    context0 = null;
    if (context1 != null) context1.close();
    context1 = null;

    // Shutting down Arjuna threads
    TxControl.disable(true);

    TransactionReaper.terminate(false);
    super.tearDown();
  }
Example #7
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;
  }