use of org.apache.ignite.internal.processors.cache.GridCacheMvcc in project ignite by apache.
the class GridLocalCacheEntry method removeLock.
/**
* {@inheritDoc}
*/
@Override
public boolean removeLock(GridCacheVersion ver) throws GridCacheEntryRemovedException {
CacheObject val;
CacheLockCandidates prev = null;
CacheLockCandidates owner = null;
GridCacheMvccCandidate doomed;
lockEntry();
try {
GridCacheVersion obsoleteVer = obsoleteVersionExtras();
if (obsoleteVer != null && !obsoleteVer.equals(ver))
checkObsolete();
GridCacheMvcc mvcc = mvccExtras();
doomed = mvcc == null ? null : mvcc.candidate(ver);
if (doomed != null) {
prev = mvcc.allOwners();
mvcc.remove(ver);
if (mvcc.isEmpty())
mvccExtras(null);
else
owner = mvcc.allOwners();
}
val = this.val;
} finally {
unlockEntry();
}
if (doomed != null)
checkThreadChain(doomed);
checkOwnerChanged(prev, owner, val);
return doomed != null;
}
use of org.apache.ignite.internal.processors.cache.GridCacheMvcc in project ignite by apache.
the class GridLocalCacheEntry method addLocal.
/**
* Add local candidate.
*
* @param threadId Owning thread ID.
* @param ver Lock version.
* @param serOrder Version for serializable transactions ordering.
* @param serReadVer Optional read entry version for optimistic serializable transaction.
* @param timeout Timeout to acquire lock.
* @param reenter Reentry flag.
* @param tx Transaction flag.
* @param implicitSingle Implicit transaction flag.
* @param read Read lock flag.
* @return New candidate.
* @throws GridCacheEntryRemovedException If entry has been removed.
*/
@Nullable
GridCacheMvccCandidate addLocal(long threadId, GridCacheVersion ver, @Nullable GridCacheVersion serOrder, @Nullable GridCacheVersion serReadVer, long timeout, boolean reenter, boolean tx, boolean implicitSingle, boolean read) throws GridCacheEntryRemovedException {
assert serReadVer == null || serOrder != null;
CacheObject val;
GridCacheMvccCandidate cand;
CacheLockCandidates prev;
CacheLockCandidates owner = null;
lockEntry();
try {
checkObsolete();
if (serReadVer != null) {
if (!checkSerializableReadVersion(serReadVer))
return null;
}
GridCacheMvcc mvcc = mvccExtras();
if (mvcc == null) {
mvcc = new GridCacheMvcc(cctx);
mvccExtras(mvcc);
}
prev = mvcc.localOwners();
cand = mvcc.addLocal(this, /*nearNodeId*/
null, /*nearVer*/
null, threadId, ver, timeout, serOrder, reenter, tx, implicitSingle, /*dht-local*/
false, read);
if (mvcc.isEmpty())
mvccExtras(null);
else
owner = mvcc.localOwners();
val = this.val;
} finally {
unlockEntry();
}
if (cand != null && !cand.reentry())
cctx.mvcc().addNext(cctx, cand);
checkOwnerChanged(prev, owner, val);
return cand;
}
Aggregations