Example #1
0
  /** {@inheritDoc} */
  @Override
  protected IgniteInternalFuture<Map<K, V>> getAllAsync(
      @Nullable Collection<? extends K> keys,
      boolean forcePrimary,
      boolean skipTx,
      @Nullable UUID subjId,
      String taskName,
      boolean deserializeBinary,
      boolean skipVals,
      boolean canRemap) {
    ctx.checkSecurity(SecurityPermission.CACHE_READ);

    if (F.isEmpty(keys)) return new GridFinishedFuture<>(Collections.<K, V>emptyMap());

    if (keyCheck) validateCacheKeys(keys);

    CacheOperationContext opCtx = ctx.operationContextPerCall();

    subjId = ctx.subjectIdPerCall(subjId, opCtx);

    return loadAsync(
        null,
        ctx.cacheKeysView(keys),
        forcePrimary,
        subjId,
        taskName,
        deserializeBinary,
        skipVals ? null : opCtx != null ? opCtx.expiry() : null,
        skipVals,
        opCtx != null && opCtx.skipStore(),
        canRemap);
  }
  /** {@inheritDoc} */
  @Override
  public void localLoadCache(final IgniteBiPredicate<K, V> p, Object[] args)
      throws IgniteCheckedException {
    if (ctx.store().isLocal()) {
      super.localLoadCache(p, args);

      return;
    }

    // Version for all loaded entries.
    final GridCacheVersion ver0 = ctx.shared().versions().nextForLoad(topology().topologyVersion());

    final boolean replicate = ctx.isDrEnabled();

    final AffinityTopologyVersion topVer = ctx.affinity().affinityTopologyVersion();

    CacheOperationContext opCtx = ctx.operationContextPerCall();

    ExpiryPolicy plc0 = opCtx != null ? opCtx.expiry() : null;

    final ExpiryPolicy plc = plc0 != null ? plc0 : ctx.expiry();

    if (p != null) ctx.kernalContext().resource().injectGeneric(p);

    try {
      ctx.store()
          .loadCache(
              new CI3<KeyCacheObject, Object, GridCacheVersion>() {
                @Override
                public void apply(KeyCacheObject key, Object val, @Nullable GridCacheVersion ver) {
                  assert ver == null;

                  loadEntry(key, val, ver0, p, topVer, replicate, plc);
                }
              },
              args);

    } finally {
      if (p instanceof PlatformCacheEntryFilter) ((PlatformCacheEntryFilter) p).onClose();
    }
  }