Beispiel #1
0
  /** {@inheritDoc} */
  @Override
  public GridFuture<Boolean> loadMissing(
      boolean async, final Collection<? extends K> keys, final GridInClosure2<K, V> closure) {
    GridFuture<Map<K, V>> f = cctx.near().txLoadAsync(this, keys, CU.<K, V>empty());

    return new GridEmbeddedFuture<Boolean, Map<K, V>>(
        cctx.kernalContext(),
        f,
        new C2<Map<K, V>, Exception, Boolean>() {
          @Override
          public Boolean apply(Map<K, V> map, Exception e) {
            if (e != null) {
              setRollbackOnly();

              throw new GridClosureException(e);
            }

            // Must loop through keys, not map entries,
            // as map entries may not have all the keys.
            for (K key : keys) closure.apply(key, map.get(key));

            return true;
          }
        });
  }