Exemplo n.º 1
0
  /** Begins a new read-only transaction. */
  public void beginReadTxn() {
    assert (!isTxnInProgress());

    if (manageReposSession) {
      repos.beginReposSession();
    }

    repos.beginReposTxn(false);
    state = State.READ_TXN;
  }
Exemplo n.º 2
0
  /** Rolls back the active transaction, if any. */
  public void rollback() {
    if (!isTxnInProgress()) {
      return;
    }

    // NOTE jvs 12-Jan-2007:  see comment in commit() for ordering rationale

    state = State.NO_TXN;
    repos.endReposTxn(true);

    if (manageReposSession) {
      repos.endReposSession();
    }
  }
Exemplo n.º 3
0
  /** Commits the active transaction, if any. */
  public void commit() {
    if (!isTxnInProgress()) {
      return;
    }

    // NOTE jvs 12-Jan-2007:  change state BEFORE attempting
    // to end transaction; if endReposTxn throws an excn,
    // we're in an unknown state, but further calls could just
    // mask the original excn, so pretend we're back to
    // State.NO_TXN regardless.

    state = State.NO_TXN;
    repos.endReposTxn(false);

    if (manageReposSession) {
      repos.endReposSession();
    }
  }
Exemplo n.º 4
0
  /** Begins a new read/write transaction. */
  public void beginWriteTxn() {
    assert (!isTxnInProgress());

    if (readOnly) {
      throw FarragoResource.instance().CatalogReadOnly.ex();
    }

    if (manageReposSession) {
      repos.beginReposSession();
    }

    // NOTE jvs 12-Jan-2007:  don't change state until AFTER successfully
    // beginning a transaction; if beginReposTxn throws an excn,
    // we want to stay in State.NO_TXN

    repos.beginReposTxn(true);
    state = State.WRITE_TXN;
  }