/** @param commit Commit flag. */
  private void finishOnePhase(boolean commit) {
    assert Thread.holdsLock(this);

    if (finishOnePhaseCalled) return;

    finishOnePhaseCalled = true;

    GridDistributedTxMapping locMapping = mappings.localMapping();

    if (locMapping != null) {
      // No need to send messages as transaction was already committed on remote node.
      // Finish local mapping only as we need send commit message to backups.
      IgniteInternalFuture<IgniteInternalTx> fut =
          cctx.tm().txHandler().finishColocatedLocal(commit, tx);

      // Add new future.
      if (fut != null) add(fut);
    }
  }