GridNearGetFuture<K, V> fut = new GridNearGetFuture<>(ctx, keys, !skipStore, fut.init(null);
assert !cctx.affinityNode(); onDone(new ClusterTopologyServerNotFoundException("Failed to map keys for near-only cache (all partition " + "nodes left the grid).")); savedEntries = map(key, topVer, mappings, mapped, savedEntries); if (isDone()) return; GridDhtFuture<Collection<GridCacheEntryInfo>> fut = dht() .getDhtAsync( n.id(), addNodeAsInvalid(n, part, topVer); map(remapKeys, mappings, updTopVer); add(fut.chain(f -> { try { return loadEntries(n.id(), mappedKeys.keySet(), f.get(), saved, topVer); onDone(e); registrateFutureInMvccManager(this); add(miniFuture); // Append new future.
onDone(serverNotFoundError(part, topVer)); final GridNearCacheAdapter near = cache(); if (localDhtGet(key, part, topVer, isNear)) break; onDone(ex); Set<ClusterNode> invalidNodesSet = getInvalidNodes(part, topVer); onDone(serverNotFoundError(part, topVer)); cache().metrics0().onRead(false); if (!checkRetryPermits(key,affNode,mapped)) return saved; addResult(key, v, ver); onDone(e);
boolean nearRead ) { GridDhtCacheAdapter<K, V> dht = cache().dht(); cache().metrics0().onRead(true); addResult(key, v, ver); return !cctx.readThroughConfigured() && (topStable || partitionOwned(part)); onDone(e);
onDone(serverNotFoundError(topVer)); final GridNearCacheAdapter near = cache(); if (localDhtGet(key, part, topVer, isNear)) break; onDone(serverNotFoundError(topVer)); cache().metrics0().onRead(false); onDone(new ClusterTopologyCheckedException("Failed to remap key to a new node after " + MAX_REMAP_CNT + " attempts (key got remapped to the same node) " + "[key=" + key + ", node=" + U.toShortString(affNode) + ", mappings=" + mapped + ']')); addResult(key, v, ver); onDone(e);
assert !cctx.affinityNode(); onDone(new ClusterTopologyServerNotFoundException("Failed to map keys for near-only cache (all partition " + "nodes left the grid).")); savedEntries = map(key, mappings, topVer, mapped, savedEntries); if (isDone()) return; dht().getDhtAsync(n.id(), -1, mappedKeys, map(remapKeys, mappings, updTopVer); add(fut.chain(new C1<IgniteInternalFuture<Collection<GridCacheEntryInfo>>, Map<K, V>>() { @Override public Map<K, V> apply(IgniteInternalFuture<Collection<GridCacheEntryInfo>> fut) { try { add(fut); // Append new future.
/** * @return DHT cache. */ private GridDhtCacheAdapter<K, V> dht() { return cache().dht(); }
/** * @param key Key. * @param v Value. * @param ver Version. */ private void addResult(KeyCacheObject key, CacheObject v, GridCacheVersion ver) { if (keepCacheObjects) { K key0 = (K)key; V val0 = needVer ? (V)new EntryGetResult(skipVals ? true : v, ver) : (V)(skipVals ? true : v); add(new GridFinishedFuture<>(Collections.singletonMap(key0, val0))); } else { K key0 = (K)cctx.unwrapBinaryIfNeeded(key, !deserializeBinary, false); V val0 = needVer ? (V)new EntryGetResult(!skipVals ? (V)cctx.unwrapBinaryIfNeeded(v, !deserializeBinary, false) : (V)Boolean.TRUE, ver) : !skipVals ? (V)cctx.unwrapBinaryIfNeeded(v, !deserializeBinary, false) : (V)Boolean.TRUE; add(new GridFinishedFuture<>(Collections.singletonMap(key0, val0))); } }
/** {@inheritDoc} */ @Override public String toString() { Collection<String> futs = F.viewReadOnly(futures(), new C1<IgniteInternalFuture<?>, String>() { @SuppressWarnings("unchecked") @Override public String apply(IgniteInternalFuture<?> f) { if (isMini(f)) { return "[node=" + ((MiniFuture)f).node().id() + ", loc=" + ((MiniFuture)f).node().isLocal() + ", done=" + f.isDone() + "]"; } else return "[loc=true, done=" + f.isDone() + "]"; } }); return S.toString(GridNearGetFuture.class, this, "innerFuts", futs, "super", super.toString()); }
AffinityTopologyVersion topVer, boolean nearRead) { GridDhtCacheAdapter<K, V> dht = cache().dht(); cache().metrics0().onRead(true); addResult(key, v, ver); return !cctx.readThroughConfigured() && (topStable || partitionOwned(part)); onDone(e);
/** * @param nodeId Sender. * @param res Result. */ @Override public void onResult(UUID nodeId, GridNearGetResponse res) { for (IgniteInternalFuture<Map<K, V>> fut : futures()) if (isMini(fut)) { MiniFuture f = (MiniFuture)fut; if (f.futureId().equals(res.miniId())) { assert f.node().id().equals(nodeId); f.onResult(res); } } }
/** {@inheritDoc} */ @Override public boolean onDone(Map<K, V> res, Throwable err) { if (super.onDone(res, err)) { // Don't forget to clean up. if (trackable) cctx.mvcc().removeFuture(futId); cache().dht().sendTtlUpdateRequest(expiryPlc); return true; } return false; }
/** * @param key Key. * @param v Value. * @param ver Version. */ @SuppressWarnings("unchecked") private void addResult(KeyCacheObject key, CacheObject v, GridCacheVersion ver) { if (keepCacheObjects) { K key0 = (K)key; V val0 = needVer ? (V)new EntryGetResult(skipVals ? true : v, ver) : (V)(skipVals ? true : v); add(new GridFinishedFuture<>(Collections.singletonMap(key0, val0))); } else { K key0 = (K)cctx.unwrapBinaryIfNeeded(key, !deserializeBinary, false); V val0 = needVer ? (V)new EntryGetResult(!skipVals ? (V)cctx.unwrapBinaryIfNeeded(v, !deserializeBinary, false) : (V)Boolean.TRUE, ver) : !skipVals ? (V)cctx.unwrapBinaryIfNeeded(v, !deserializeBinary, false) : (V)Boolean.TRUE; add(new GridFinishedFuture<>(Collections.singletonMap(key0, val0))); } }
assert tx != null; GridNearGetFuture<K, V> fut = new GridNearGetFuture<>(ctx, keys, readThrough, fut.init(topVer);
/** * @return DHT cache. */ private GridDhtCacheAdapter<K, V> dht() { return cache().dht(); }
GridNearGetFuture<K, V> fut = new GridNearGetFuture<>(ctx, keys, !skipStore, fut.init(null);
/** {@inheritDoc} */ @Override public boolean onDone(Map<K, V> res, Throwable err) { if (super.onDone(res, err)) { // Don't forget to clean up. if (trackable) cctx.mvcc().removeFuture(futId); cache().dht().sendTtlUpdateRequest(expiryPlc); return true; } return false; }