use of org.apache.ignite.internal.processors.cache.GridCacheContext in project ignite by apache.
the class GridDistributedCacheEntry method checkThreadChain.
/** {@inheritDoc} */
@Override
protected final void checkThreadChain(GridCacheMvccCandidate owner) {
assert !Thread.holdsLock(this);
assert owner != null;
assert owner.owner() || owner.used() : "Neither owner or used flags are set on ready local candidate: " + owner;
if (owner.local() && owner.next() != null) {
for (GridCacheMvccCandidate cand = owner.next(); cand != null; cand = cand.next()) {
assert cand.local() : "Remote candidate cannot be part of thread chain: " + cand;
// Allow next lock in the thread to proceed.
if (!cand.used()) {
GridCacheContext cctx0 = cand.parent().context();
GridDistributedCacheEntry e = (GridDistributedCacheEntry) cctx0.cache().peekEx(cand.parent().key());
if (e != null)
e.recheck();
break;
}
}
}
}
use of org.apache.ignite.internal.processors.cache.GridCacheContext in project ignite by apache.
the class GridDhtLockResponse method finishUnmarshal.
/** {@inheritDoc} */
@Override
public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
super.finishUnmarshal(ctx, ldr);
GridCacheContext cctx = ctx.cacheContext(cacheId);
if (nearEvicted != null) {
for (IgniteTxKey key : nearEvicted) key.finishUnmarshal(cctx, ldr);
}
if (preloadEntries != null)
unmarshalInfos(preloadEntries, ctx.cacheContext(cacheId), ldr);
}
use of org.apache.ignite.internal.processors.cache.GridCacheContext in project ignite by apache.
the class GridDhtLockResponse method prepareMarshal.
/** {@inheritDoc}
* @param ctx*/
@Override
public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
super.prepareMarshal(ctx);
GridCacheContext cctx = ctx.cacheContext(cacheId);
if (nearEvicted != null) {
for (IgniteTxKey key : nearEvicted) key.prepareMarshal(cctx);
}
if (preloadEntries != null)
marshalInfos(preloadEntries, cctx);
}
use of org.apache.ignite.internal.processors.cache.GridCacheContext in project ignite by apache.
the class GridDhtTxFinishResponse method prepareMarshal.
/** {@inheritDoc} */
@Override
public void prepareMarshal(GridCacheSharedContext ctx) throws IgniteCheckedException {
super.prepareMarshal(ctx);
if (checkCommittedErr != null && checkCommittedErrBytes == null)
checkCommittedErrBytes = U.marshal(ctx, checkCommittedErr);
if (retVal != null && retVal.cacheId() != 0) {
GridCacheContext cctx = ctx.cacheContext(retVal.cacheId());
assert cctx != null : retVal.cacheId();
retVal.prepareMarshal(cctx);
}
}
use of org.apache.ignite.internal.processors.cache.GridCacheContext in project ignite by apache.
the class GridDhtTxLocalAdapter method mapExplicitLocks.
/**
* Map explicit locks.
*/
protected void mapExplicitLocks() {
if (!mapped) {
// Explicit locks may participate in implicit transactions only.
if (!implicit()) {
mapped = true;
return;
}
Map<ClusterNode, List<GridDhtCacheEntry>> dhtEntryMap = null;
Map<ClusterNode, List<GridDhtCacheEntry>> nearEntryMap = null;
for (IgniteTxEntry e : allEntries()) {
assert e.cached() != null;
GridCacheContext cacheCtx = e.cached().context();
if (cacheCtx.isNear())
continue;
if (e.cached().obsolete()) {
GridCacheEntryEx cached = cacheCtx.cache().entryEx(e.key(), topologyVersion());
e.cached(cached);
}
if (e.cached().detached() || e.cached().isLocal())
continue;
while (true) {
try {
// Map explicit locks.
if (e.explicitVersion() != null && !e.explicitVersion().equals(xidVer)) {
if (dhtEntryMap == null)
dhtEntryMap = new GridLeanMap<>();
if (nearEntryMap == null)
nearEntryMap = new GridLeanMap<>();
cacheCtx.dhtMap((GridDhtCacheEntry) e.cached(), e.explicitVersion(), log, dhtEntryMap, nearEntryMap);
}
break;
} catch (GridCacheEntryRemovedException ignore) {
GridCacheEntryEx cached = cacheCtx.cache().entryEx(e.key(), topologyVersion());
e.cached(cached);
}
}
}
if (!F.isEmpty(dhtEntryMap))
addDhtNodeEntryMapping(dhtEntryMap);
if (!F.isEmpty(nearEntryMap))
addNearNodeEntryMapping(nearEntryMap);
mapped = true;
}
}
Aggregations