コード例 #1
0
  /**
   * @param nodeId Sender ID.
   * @param res Response.
   */
  private void processGetResponse(UUID nodeId, GridNearGetResponse<K, V> res) {
    GridNearGetFuture<K, V> fut =
        (GridNearGetFuture<K, V>) ctx.mvcc().<Map<K, V>>future(res.version().id(), res.futureId());

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

      return;
    }

    fut.onResult(nodeId, res);
  }
コード例 #2
0
  /**
   * @param tx Transaction.
   * @param keys Keys to load.
   * @param filter Filter.
   * @return Future.
   */
  GridFuture<Map<K, V>> txLoadAsync(
      GridNearTxLocal<K, V> tx,
      @Nullable Collection<? extends K> keys,
      @Nullable GridPredicate<? super GridCacheEntry<K, V>>[] filter) {
    assert tx != null;

    GridNearGetFuture<K, V> fut = new GridNearGetFuture<K, V>(ctx, keys, false, tx, filter);

    // Register future for responses.
    ctx.mvcc().addFuture(fut);

    fut.init();

    return fut;
  }
コード例 #3
0
  /**
   * @param keys Keys to load.
   * @param reload Reload flag.
   * @param filter Filter.
   * @return Loaded values.
   */
  public GridFuture<Map<K, V>> loadAsync(
      @Nullable Collection<? extends K> keys,
      boolean reload,
      @Nullable GridPredicate<? super GridCacheEntry<K, V>>[] filter) {
    if (F.isEmpty(keys))
      return new GridFinishedFuture<Map<K, V>>(ctx.kernalContext(), Collections.<K, V>emptyMap());

    GridNearGetFuture<K, V> fut = new GridNearGetFuture<K, V>(ctx, keys, reload, null, filter);

    // Register future for responses.
    ctx.mvcc().addFuture(fut);

    fut.init();

    return ctx.wrapCloneMap(fut);
  }