コード例 #1
0
  /** {@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;
  }
コード例 #2
0
  /** {@inheritDoc} */
  @Override
  public CacheQueryFuture<?> queryLocal(GridCacheQueryBean qry) {
    assert cctx.config().getCacheMode() != LOCAL;

    if (log.isDebugEnabled()) log.debug("Executing query on local node: " + qry);

    GridCacheLocalQueryFuture<K, V, ?> fut = new GridCacheLocalQueryFuture<>(cctx, qry);

    try {
      qry.query().validate();

      fut.execute();
    } catch (IgniteCheckedException e) {
      fut.onDone(e);
    }

    return fut;
  }