/** {@inheritDoc} */
  @Override
  protected boolean onPageReady(
      boolean loc, GridCacheQueryInfo qryInfo, Collection<?> data, boolean finished, Throwable e) {
    GridCacheLocalQueryFuture<?, ?, ?> fut = qryInfo.localQueryFuture();

    if (loc) assert fut != null;

    if (e != null) {
      if (loc) fut.onPage(null, null, e, true);
      else
        sendQueryResponse(
            qryInfo.senderId(),
            new GridCacheQueryResponse(cctx.cacheId(), qryInfo.requestId(), e),
            qryInfo.query().timeout());

      return true;
    }

    if (loc) fut.onPage(null, data, null, finished);
    else {
      GridCacheQueryResponse res =
          new GridCacheQueryResponse(
              cctx.cacheId(), qryInfo.requestId(), /*finished*/ false, /*fields*/ false);

      res.data(data);
      res.finished(finished);

      if (!sendQueryResponse(qryInfo.senderId(), res, qryInfo.query().timeout())) return false;
    }

    return true;
  }