/** * */ private void onLeft() { for (CacheGroupContext grp : cctx.cache().cacheGroups()) { if (grp.isLocal()) continue; grp.preloader().unwindUndeploys(); cctx.exchange().exchangerUpdateHeartbeat(); } }
/** * Get affinity assignment for the given topology version. * * @param topVer Topology version. * @return Affinity assignment. */ public AffinityAssignment assignment(AffinityTopologyVersion topVer) { return assignment(topVer, cctx.shared().exchange().lastAffinityChangedTopologyVersion(topVer)); }
/** * @param e Transaction entry. * @param topVer Topology version. * @return {@code True} if entry is locally mapped as a primary or back up node. */ protected boolean isNearLocallyMapped(GridCacheEntryEx e, AffinityTopologyVersion topVer) { return ctx.affinity().partitionBelongs(ctx.localNode(), e.partition(), topVer); }
/** * @param entry Entry. * @return {@code True} if local node is current primary for given entry. */ private boolean primaryLocal(GridCacheEntryEx entry) { return entry.context().affinity().primaryByPartition(cctx.localNode(), entry.partition(), AffinityTopologyVersion.NONE); }
/** {@inheritDoc} */ @Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException { super.finishUnmarshal(ctx, ldr); assert key != null; GridCacheContext cctx = ctx.cacheContext(cacheId); key.finishUnmarshal(cctx.cacheObjectContext(), ldr); }
/** {@inheritDoc} */ @Override public void run() { for (GridCacheEntryEx gridCacheEntryEx : cache.entries()) clearEntry(gridCacheEntryEx); if (!ctx.isNear()) { if (id == 0) ctx.offheap().clearCache(ctx, readers); } }
/** * @param key Entry key. * @return Entry (never {@code null}). */ public final GridCacheEntryEx entryEx(KeyCacheObject key) { return entryEx(key, ctx.affinity().affinityTopologyVersion()); }
/** * @param opCtx Cache operation context. */ private void onEnter(CacheOperationContext opCtx) { ctx.itHolder().checkWeakQueue(); if (ctx.deploymentEnabled()) ctx.deploy().onEnter(); if (opCtx != null) checkAtomicOpsInTx(opCtx); }
/** * @param cctx Cache context. * @throws IgniteCheckedException In case of error. */ void prepareMarshal(GridCacheContext cctx) throws IgniteCheckedException { if (key != null) key.prepareMarshal(cctx.cacheObjectContext()); if (newVal != null) newVal.prepareMarshal(cctx.cacheObjectContext()); if (oldVal != null) oldVal.prepareMarshal(cctx.cacheObjectContext()); }
/** {@inheritDoc} */ @Override protected void onKernalStop0(boolean cancel) { if (pendingEntries != null) pendingEntries.clear(); cctx.shared().ttl().unregister(this); }
/** {@inheritDoc} */ @Override public GridCacheProxyImpl<K, V> withExpiryPolicy(ExpiryPolicy plc) { CacheOperationContext prev = gate.enter(opCtx); try { return new GridCacheProxyImpl<>(ctx, delegate, opCtx != null ? opCtx.withExpiryPolicy(plc) : new CacheOperationContext(false, null, false, plc, false, null, false, DFLT_ALLOW_ATOMIC_OPS_IN_TX)); } finally { gate.leave(prev); } }
/** {@inheritDoc} */ @Override public GridDhtPartitionTopology topology(DiscoCache discoCache) { return cctx.exchange().clientTopology(groupId(), discoCache); } }
/** {@inheritDoc} */ @Override public Iterator<Cache.Entry<K, V>> iterator() { GridCacheContext<K, V> ctx = getContextSafe(); try { return ctx.cache().igniteIterator(); } catch (IgniteCheckedException | IgniteException e) { throw cacheException(e); } }
/** * @return The size of pending entries. * @throws IgniteCheckedException If failed. */ public long pendingSize() throws IgniteCheckedException { return (pendingEntries != null ? pendingEntries.sizex() : 0) + cctx.offheap().expiredSize(); }
/** {@inheritDoc} */ @Override public CacheMetricsMXBean mxBean() { GridCacheContext<K, V> ctx = getContextSafe(); return ctx.cache().clusterMxBean(); }
/** {@inheritDoc} */ @Override public CacheMetricsMXBean localMxBean() { GridCacheContext<K, V> ctx = getContextSafe(); return ctx.cache().localMxBean(); }
/** * * @param key Entry key. */ public final void removeIfObsolete(KeyCacheObject key) { assert key != null; GridCacheMapEntry entry = map.getEntry(ctx, key); if (entry != null && entry.obsolete()) removeEntry(entry); }
/** {@inheritDoc} */ @Override public CacheMetrics metrics() { GridCacheContext<K, V> ctx = getContextSafe(); return ctx.cache().clusterMetrics(); }
/** * @return Internal proxy. */ @Override public GridCacheProxyImpl<K, V> internalProxy() { GridCacheContext<K, V> ctx = getContextSafe(); IgniteInternalCache<K, V> delegate = getDelegateSafe(); return new GridCacheProxyImpl<>(ctx, delegate, ctx.operationContextPerCall()); }
/** {@inheritDoc} */ @Override public IgniteInternalCache<K, V> withAllowAtomicOpsInTx() { CacheOperationContext prev = gate.enter(opCtx); try { return new GridCacheProxyImpl<>(ctx, delegate, opCtx.setAllowAtomicOpsInTx()); } finally { gate.leave(prev); } }