/**
   * @param nodeId Node ID.
   * @param res Response.
   */
  private void processFinishResponse(UUID nodeId, GridNearTxFinishResponse<K, V> res) {
    GridNearTxFinishFuture<K, V> fut =
        (GridNearTxFinishFuture<K, V>)
            ctx.mvcc().<GridCacheTx>future(res.xid().id(), res.futureId());

    if (fut == null) {
      if (log.isDebugEnabled())
        log.debug(
            "Failed to find future for finish response [sender=" + nodeId + ", res=" + res + ']');

      return;
    }

    fut.onResult(nodeId, res);
  }
  /**
   * @param nodeId Sender.
   * @param res Result.
   */
  @SuppressWarnings("ForLoopReplaceableByForEach")
  public void onResult(UUID nodeId, GridNearTxFinishResponse res) {
    if (!isDone()) {
      FinishMiniFuture finishFut = null;

      synchronized (futs) {
        for (int i = 0; i < futs.size(); i++) {
          IgniteInternalFuture<IgniteInternalTx> fut = futs.get(i);

          if (fut.getClass() == FinishMiniFuture.class) {
            FinishMiniFuture f = (FinishMiniFuture) fut;

            if (f.futureId().equals(res.miniId())) {
              assert f.node().id().equals(nodeId);

              finishFut = f;

              break;
            }
          }
        }
      }

      if (finishFut != null) finishFut.onNearFinishResponse(res);
    }
  }
  /**
   * @param nodeId Sender.
   * @param res Result.
   */
  void onResult(UUID nodeId, GridNearTxFinishResponse<K, V> res) {
    if (!isDone())
      for (GridFuture<GridCacheTx> fut : futures()) {
        if (isMini(fut)) {
          MiniFuture f = (MiniFuture) fut;

          if (f.futureId().equals(res.miniId())) {
            assert f.node().id().equals(nodeId);

            f.onResult(res);
          }
        }
      }
  }
 /** @param res Result callback. */
 void onNearFinishResponse(GridNearTxFinishResponse res) {
   if (res.error() != null) onDone(res.error());
   else onDone(tx);
 }
 /** @param res Result callback. */
 void onResult(GridNearTxFinishResponse<K, V> res) {
   if (res.error() != null) onDone(res.error());
   else onDone(tx);
 }