/** {@inheritDoc} */
  @SuppressWarnings({"unchecked"})
  @Override
  public GridFuture<?> reloadAllAsync() {
    GridCompoundFuture fut = new GridCompoundFuture(ctx.kernalContext());

    fut.add(super.reloadAllAsync());
    fut.add(dht.reloadAllAsync());

    fut.markInitialized();

    return fut;
  }
  /** {@inheritDoc} */
  @SuppressWarnings({"unchecked"})
  @Override
  public GridFuture<?> reloadAllAsync(
      @Nullable GridPredicate<? super GridCacheEntry<K, V>>[] filter) {
    GridCompoundFuture fut = new GridCompoundFuture(ctx.kernalContext());

    fut.add(super.reloadAllAsync());
    fut.add(dht.reloadAllAsync(filter));

    fut.markInitialized();

    return fut;
  }
Esempio n. 3
0
    /**
     * @return Future if any submitted.
     * @throws GridInterruptedException If thread has been interrupted.
     */
    @Nullable
    GridFuture<?> flush() throws GridInterruptedException {
      List<Map.Entry<K, V>> entries0 = null;
      GridFutureAdapter<Object> curFut0 = null;

      synchronized (this) {
        if (!entries.isEmpty()) {
          entries0 = entries;
          curFut0 = curFut;

          entries = newEntries();
          curFut = new GridFutureAdapter<>(ctx);
          curFut.listenAsync(signalC);
        }
      }

      if (entries0 != null) submit(entries0, curFut0);

      // Create compound future for this flush.
      GridCompoundFuture<Object, Object> res = null;

      for (GridFuture<Object> f : locFuts) {
        if (res == null) res = new GridCompoundFuture<>(ctx);

        res.add(f);
      }

      for (GridFuture<Object> f : reqs.values()) {
        if (res == null) res = new GridCompoundFuture<>(ctx);

        res.add(f);
      }

      if (res != null) res.markInitialized();

      return res;
    }