use of org.apache.ignite.internal.processors.cache.CacheLockCandidates in project ignite by apache.
the class GridDistributedCacheEntry method recheck.
/**
* Rechecks if lock should be reassigned.
*/
public void recheck() {
CacheLockCandidates prev = null;
CacheLockCandidates owner = null;
CacheObject val;
lockEntry();
try {
GridCacheMvcc mvcc = mvccExtras();
if (mvcc != null) {
prev = mvcc.allOwners();
boolean emptyBefore = mvcc.isEmpty();
owner = mvcc.recheck();
boolean emptyAfter = mvcc.isEmpty();
checkCallbacks(emptyBefore, emptyAfter);
if (emptyAfter)
mvccExtras(null);
}
val = this.val;
} finally {
unlockEntry();
}
// This call must be made outside of synchronization.
checkOwnerChanged(prev, owner, val);
}
use of org.apache.ignite.internal.processors.cache.CacheLockCandidates in project ignite by apache.
the class GridLocalCacheEntry method recheck.
/**
* Rechecks if lock should be reassigned.
*/
public void recheck() {
CacheObject val;
CacheLockCandidates prev = null;
CacheLockCandidates owner = null;
lockEntry();
try {
GridCacheMvcc mvcc = mvccExtras();
if (mvcc != null) {
prev = mvcc.allOwners();
owner = mvcc.recheck();
if (mvcc.isEmpty())
mvccExtras(null);
}
val = this.val;
} finally {
unlockEntry();
}
checkOwnerChanged(prev, owner, val);
}
use of org.apache.ignite.internal.processors.cache.CacheLockCandidates in project ignite by apache.
the class GridDistributedCacheEntry method doneRemote.
/**
* @param lockVer Done version.
* @param baseVer Base version.
* @param pendingVers Pending versions that are less than lock version.
* @param committedVers Completed versions for reordering.
* @param rolledbackVers Rolled back versions for reordering.
* @param sysInvalidate Flag indicating if this entry is done from invalidated transaction (in case of tx
* salvage). In this case all locks before salvaged lock will marked as used and corresponding
* transactions will be invalidated.
* @throws GridCacheEntryRemovedException If entry has been removed.
*/
public void doneRemote(GridCacheVersion lockVer, GridCacheVersion baseVer, @Nullable Collection<GridCacheVersion> pendingVers, Collection<GridCacheVersion> committedVers, Collection<GridCacheVersion> rolledbackVers, boolean sysInvalidate) throws GridCacheEntryRemovedException {
CacheLockCandidates prev = null;
CacheLockCandidates owner = null;
CacheObject val;
lockEntry();
try {
checkObsolete();
GridCacheMvcc mvcc = mvccExtras();
if (mvcc != null) {
prev = mvcc.allOwners();
boolean emptyBefore = mvcc.isEmpty();
// Order completed versions.
if (!F.isEmpty(committedVers) || !F.isEmpty(rolledbackVers)) {
mvcc.orderCompleted(lockVer, committedVers, rolledbackVers);
if (!baseVer.equals(lockVer))
mvcc.orderCompleted(baseVer, committedVers, rolledbackVers);
}
if (sysInvalidate && baseVer != null)
mvcc.salvageRemote(baseVer, isNear());
owner = mvcc.doneRemote(lockVer, maskNull(pendingVers), maskNull(committedVers), maskNull(rolledbackVers));
boolean emptyAfter = mvcc.isEmpty();
checkCallbacks(emptyBefore, emptyAfter);
if (emptyAfter)
mvccExtras(null);
}
val = this.val;
} finally {
unlockEntry();
}
// This call must be made outside of synchronization.
checkOwnerChanged(prev, owner, val);
}
use of org.apache.ignite.internal.processors.cache.CacheLockCandidates in project ignite by apache.
the class GridLocalCacheEntry method releaseLocal.
/**
* Releases local lock.
*
* @param threadId Thread ID.
*/
private void releaseLocal(long threadId) {
CacheObject val;
CacheLockCandidates prev = null;
CacheLockCandidates owner = null;
lockEntry();
try {
GridCacheMvcc mvcc = mvccExtras();
if (mvcc != null) {
prev = mvcc.localOwners();
mvcc.releaseLocal(threadId);
if (mvcc.isEmpty())
mvccExtras(null);
else
owner = mvcc.allOwners();
}
val = this.val;
} finally {
unlockEntry();
}
if (prev != null) {
for (int i = 0; i < prev.size(); i++) {
GridCacheMvccCandidate cand = prev.candidate(i);
boolean unlocked = owner == null || !owner.hasCandidate(cand.version());
if (unlocked)
checkThreadChain(cand);
}
}
checkOwnerChanged(prev, owner, val);
}
use of org.apache.ignite.internal.processors.cache.CacheLockCandidates in project ignite by apache.
the class GridLocalCacheEntry method readyLocal.
/**
* @param cand Candidate.
*/
void readyLocal(GridCacheMvccCandidate cand) {
CacheObject val;
CacheLockCandidates prev = null;
CacheLockCandidates owner = null;
lockEntry();
try {
GridCacheMvcc mvcc = mvccExtras();
if (mvcc != null) {
prev = mvcc.localOwners();
owner = mvcc.readyLocal(cand);
if (mvcc.isEmpty())
mvccExtras(null);
}
val = this.val;
} finally {
unlockEntry();
}
checkOwnerChanged(prev, owner, val);
}
Aggregations