コード例 #1
0
ファイル: TxManager.java プロジェクト: ruderphilipp/community
  @Override
  public void commit()
      throws RollbackException, HeuristicMixedException, HeuristicRollbackException,
          IllegalStateException, SystemException {
    assertTmOk("tx commit");
    Thread thread = Thread.currentThread();
    TransactionImpl tx = txThreadMap.get(thread);
    if (tx == null) {
      throw logAndReturn("TM error tx commit", new IllegalStateException("Not in transaction"));
    }

    boolean hasAnyLocks = false;
    boolean successful = false;
    try {
      hasAnyLocks = finishHook.hasAnyLocks(tx);
      if (tx.getStatus() != Status.STATUS_ACTIVE
          && tx.getStatus() != Status.STATUS_MARKED_ROLLBACK) {
        throw logAndReturn(
            "TM error tx commit",
            new IllegalStateException("Tx status is: " + getTxStatusAsString(tx.getStatus())));
      }
      tx.doBeforeCompletion();
      // delist resources?
      if (tx.getStatus() == Status.STATUS_ACTIVE) {
        comittedTxCount.incrementAndGet();
        commit(thread, tx);
      } else if (tx.getStatus() == Status.STATUS_MARKED_ROLLBACK) {
        rolledBackTxCount.incrementAndGet();
        rollbackCommit(thread, tx);
      } else {
        throw logAndReturn(
            "TM error tx commit",
            new IllegalStateException("Tx status is: " + getTxStatusAsString(tx.getStatus())));
      }
      successful = true;
    } finally {
      if (hasAnyLocks) {
        finishHook.finishTransaction(tx.getEventIdentifier(), successful);
      }
    }
  }
コード例 #2
0
ファイル: TransactionImpl.java プロジェクト: facboy/community
 public synchronized void commit()
     throws RollbackException, HeuristicMixedException, HeuristicRollbackException,
         IllegalStateException, SystemException {
   // make sure tx not suspended
   txManager.commit();
 }
コード例 #3
0
ファイル: LabelIT.java プロジェクト: pombredanne/neo4j-fork
 private void commit(HighlyAvailableGraphDatabase db, javax.transaction.Transaction tx)
     throws Exception {
   TxManager txManager = db.getDependencyResolver().resolveDependency(TxManager.class);
   txManager.resume(tx);
   txManager.commit();
 }