public final class GridCacheMvcc<K> extends Object
GridCacheVersionManager.next() for information on how lock IDs are
generated to prevent starvation.| Constructor and Description |
|---|
GridCacheMvcc(GridCacheContext<K,?> cctx) |
| Modifier and Type | Method and Description |
|---|---|
GridCacheMvccCandidate<K> |
addLocal(GridCacheEntryEx<K,?> parent,
long threadId,
GridCacheVersion ver,
long timeout,
boolean reenter,
boolean tx,
boolean implicitSingle) |
GridCacheMvccCandidate<K> |
addLocal(GridCacheEntryEx<K,?> parent,
UUID nearNodeId,
GridCacheVersion nearVer,
long threadId,
GridCacheVersion ver,
long timeout,
boolean reenter,
boolean tx,
boolean implicitSingle,
boolean dhtLoc) |
GridCacheMvccCandidate<K> |
addNearLocal(GridCacheEntryEx<K,?> parent,
UUID nodeId,
UUID otherNodeId,
long threadId,
GridCacheVersion ver,
long timeout,
boolean tx,
boolean implicitSingle)
Adds new near local lock candidate.
|
GridCacheMvccCandidate<K> |
addRemote(GridCacheEntryEx<K,?> parent,
UUID nodeId,
UUID otherNodeId,
long threadId,
GridCacheVersion ver,
long timeout,
boolean tx,
boolean implicitSingle,
boolean nearLoc)
Adds new remote lock candidate (either near remote or dht remote).
|
void |
addRemote(GridCacheMvccCandidate<K> cand) |
GridCacheMvccCandidate<K> |
anyOwner() |
GridCacheMvccCandidate<K> |
candidate(GridCacheVersion ver)
Gets candidate for lock ID.
|
GridCacheMvccCandidate<K> |
doneRemote(GridCacheVersion ver,
Collection<GridCacheVersion> pending,
Collection<GridCacheVersion> committed,
Collection<GridCacheVersion> rolledback)
Sets remote candidate to done.
|
GridCacheMvccCandidate<K> |
firstLocal() |
GridCacheMvccCandidate<K> |
firstRemote() |
boolean |
hasCandidate(GridCacheVersion ver) |
boolean |
isEmpty(GridCacheVersion... exclude) |
boolean |
isLocallyOwned(GridCacheVersion lockVer) |
boolean |
isLocallyOwnedByCurrentThread() |
boolean |
isLocallyOwnedByIdOrThread(GridCacheVersion lockVer,
long threadId) |
boolean |
isLocallyOwnedByThread(long threadId,
boolean allowDhtLoc,
GridCacheVersion... exclude) |
boolean |
isLockedByThread(long threadId,
UUID nodeId) |
boolean |
isOwnedBy(GridCacheVersion ver) |
boolean |
isOwnedByAny() |
GridCacheMvccCandidate<K> |
localCandidate(long threadId)
Gets candidate for lock ID.
|
GridCacheMvccCandidate<K> |
localCandidate(UUID nodeId,
long threadId)
Near local candidate.
|
List<GridCacheMvccCandidate<K>> |
localCandidates(boolean reentries,
GridCacheVersion... excludeVers) |
Collection<GridCacheMvccCandidate<K>> |
localCandidates(GridCacheVersion... excludeVers) |
List<GridCacheMvccCandidate<K>> |
localCandidatesNoCopy(boolean reentry) |
GridCacheMvccCandidate<K> |
localOwner() |
GridCacheMvccCandidate<K> |
markOwned(GridCacheVersion baseVer,
GridCacheVersion owned)
Puts owned versions in front of base.
|
GridCacheMvccCandidate<K> |
orderCompleted(GridCacheVersion baseVer,
Collection<GridCacheVersion> committedVers,
Collection<GridCacheVersion> rolledbackVers)
Moves completed candidates right before the base one.
|
GridCacheMvccCandidate<K> |
readyLocal(GridCacheMvccCandidate<K> cand) |
GridCacheMvccCandidate<K> |
readyLocal(GridCacheVersion ver) |
GridCacheMvccCandidate<K> |
readyNearLocal(GridCacheVersion ver,
GridCacheVersion mappedVer,
Collection<GridCacheVersion> committedVers,
Collection<GridCacheVersion> rolledBackVers,
Collection<GridCacheVersion> pending)
Marks near-local candidate as ready and makes locks reassignment.
|
GridCacheMvccCandidate<K> |
recheck()
Checks if lock should be assigned.
|
GridCacheMvccCandidate<K> |
releaseLocal()
Local local release.
|
GridCacheMvccCandidate<K> |
releaseLocal(long threadId)
Local release.
|
GridCacheMvccCandidate<K> |
remoteCandidate(UUID nodeId,
long threadId) |
List<GridCacheMvccCandidate<K>> |
remoteCandidates(GridCacheVersion... excludeVers) |
GridCacheMvccCandidate<K> |
remoteOwner() |
GridCacheMvccCandidate<K> |
remove(GridCacheVersion ver)
Removes lock even if it is not owner.
|
GridCacheMvccCandidate<K> |
removeExplicitNodeCandidates(UUID nodeId)
Removes all candidates for node.
|
void |
salvageRemote(GridCacheVersion ver)
For all remote candidates standing behind the candidate being salvaged marks their transactions
as system invalidate and marks these candidates as owned and used.
|
String |
toString() |
public GridCacheMvcc(GridCacheContext<K,?> cctx)
cctx - Cache context.@Nullable public GridCacheMvccCandidate<K> anyOwner()
@Nullable public GridCacheMvccCandidate<K> remoteOwner()
@Nullable public GridCacheMvccCandidate<K> localOwner()
public boolean isEmpty(GridCacheVersion... exclude)
exclude - Versions to exclude form check.True if lock is empty.@Nullable public GridCacheMvccCandidate<K> orderCompleted(GridCacheVersion baseVer, Collection<GridCacheVersion> committedVers, Collection<GridCacheVersion> rolledbackVers)
false is
returned.baseVer - Base version.committedVers - Committed versions relative to base.rolledbackVers - Rolled back versions relative to base.@Nullable public GridCacheMvccCandidate<K> markOwned(GridCacheVersion baseVer, GridCacheVersion owned)
baseVer - Base version.owned - Owned list.@Nullable public GridCacheMvccCandidate<K> addLocal(GridCacheEntryEx<K,?> parent, long threadId, GridCacheVersion ver, long timeout, boolean reenter, boolean tx, boolean implicitSingle)
parent - Parent entry.threadId - Thread ID.ver - Lock version.timeout - Lock acquisition timeout.reenter - Reentry flag (true if reentry is allowed).tx - Transaction flag.implicitSingle - Implicit transaction flag.@Nullable public GridCacheMvccCandidate<K> addLocal(GridCacheEntryEx<K,?> parent, @Nullable UUID nearNodeId, @Nullable GridCacheVersion nearVer, long threadId, GridCacheVersion ver, long timeout, boolean reenter, boolean tx, boolean implicitSingle, boolean dhtLoc)
parent - Parent entry.nearNodeId - Near node ID.nearVer - Near version.threadId - Thread ID.ver - Lock version.timeout - Lock acquisition timeout.reenter - Reentry flag (true if reentry is allowed).tx - Transaction flag.implicitSingle - Implicit flag.dhtLoc - DHT local flag.public GridCacheMvccCandidate<K> addRemote(GridCacheEntryEx<K,?> parent, UUID nodeId, @Nullable UUID otherNodeId, long threadId, GridCacheVersion ver, long timeout, boolean tx, boolean implicitSingle, boolean nearLoc)
parent - Parent entry.nodeId - Node ID.otherNodeId - Other node ID.threadId - Thread ID.ver - Lock version.timeout - Lock acquire timeout.tx - Transaction flag.implicitSingle - Implicit flag.nearLoc - Near local flag.public GridCacheMvccCandidate<K> addNearLocal(GridCacheEntryEx<K,?> parent, UUID nodeId, @Nullable UUID otherNodeId, long threadId, GridCacheVersion ver, long timeout, boolean tx, boolean implicitSingle)
parent - Parent entry.nodeId - Node ID.otherNodeId - Other node ID.threadId - Thread ID.ver - Lock version.timeout - Lock acquire timeout.tx - Transaction flag.implicitSingle - Implicit flag.public void addRemote(GridCacheMvccCandidate<K> cand)
cand - Remote candidate.@Nullable public GridCacheMvccCandidate<K> readyLocal(GridCacheVersion ver)
ver - Lock version to acquire or set to ready.@Nullable public GridCacheMvccCandidate<K> readyLocal(GridCacheMvccCandidate<K> cand)
cand - Local candidate added in any of the addLocal(..) methods.@Nullable public GridCacheMvccCandidate<K> readyNearLocal(GridCacheVersion ver, GridCacheVersion mappedVer, Collection<GridCacheVersion> committedVers, Collection<GridCacheVersion> rolledBackVers, Collection<GridCacheVersion> pending)
ver - Version to mark as ready.mappedVer - Mapped dht version.committedVers - Committed versions.rolledBackVers - Rolled back versions.pending - Pending dht versions that are not owned and which version is less then mapped.@Nullable public GridCacheMvccCandidate<K> doneRemote(GridCacheVersion ver, Collection<GridCacheVersion> pending, Collection<GridCacheVersion> committed, Collection<GridCacheVersion> rolledback)
ver - Version.pending - Pending versions.committed - Committed versions.rolledback - Rolledback versions.public void salvageRemote(GridCacheVersion ver)
ver - Version to salvage.@Nullable public GridCacheMvccCandidate<K> recheck()
@Nullable public GridCacheMvccCandidate<K> releaseLocal()
@Nullable public GridCacheMvccCandidate<K> releaseLocal(long threadId)
threadId - ID of the thread.@Nullable public GridCacheMvccCandidate<K> remove(GridCacheVersion ver)
ver - Lock version.@Nullable public GridCacheMvccCandidate<K> removeExplicitNodeCandidates(UUID nodeId)
nodeId - Node ID.@Nullable public GridCacheMvccCandidate<K> candidate(GridCacheVersion ver)
ver - Lock version.@Nullable public GridCacheMvccCandidate<K> localCandidate(long threadId)
threadId - Thread ID.@Nullable public GridCacheMvccCandidate<K> remoteCandidate(UUID nodeId, long threadId)
nodeId - Node ID.threadId - Thread ID.@Nullable public GridCacheMvccCandidate<K> localCandidate(UUID nodeId, long threadId)
nodeId - Node ID.threadId - Thread ID.public boolean hasCandidate(GridCacheVersion ver)
ver - Version.True if candidate with given version exists.public List<GridCacheMvccCandidate<K>> localCandidatesNoCopy(boolean reentry)
reentry - Reentry flag.public Collection<GridCacheMvccCandidate<K>> localCandidates(GridCacheVersion... excludeVers)
excludeVers - Exclude versions.public List<GridCacheMvccCandidate<K>> localCandidates(boolean reentries, GridCacheVersion... excludeVers)
reentries - Flag to include reentries.excludeVers - Exclude versions.public List<GridCacheMvccCandidate<K>> remoteCandidates(GridCacheVersion... excludeVers)
excludeVers - Exclude versions.public boolean isLocallyOwnedByCurrentThread()
True if lock is owner by current thread.public boolean isLocallyOwnedByThread(long threadId,
boolean allowDhtLoc,
GridCacheVersion... exclude)
threadId - Thread ID to check.exclude - Versions to ignore.True if lock is owned by the thread with given ID.public boolean isLockedByThread(long threadId,
UUID nodeId)
threadId - Thread ID.nodeId - Node ID.True if lock is held by given thread and node IDs.public boolean isOwnedByAny()
True if lock is owned by any thread or node.public boolean isLocallyOwned(GridCacheVersion lockVer)
lockVer - ID of lock candidate.True if candidate is owner.public boolean isLocallyOwnedByIdOrThread(GridCacheVersion lockVer, long threadId)
lockVer - Lock ID.threadId - Thread ID.True if locked by lock ID or thread ID.@Nullable public GridCacheMvccCandidate<K> firstRemote()
@Nullable public GridCacheMvccCandidate<K> firstLocal()
public boolean isOwnedBy(GridCacheVersion ver)
ver - Version to check for ownership.True if lock is owned by the specified version.
Follow @ApacheIgnite
Ignite Fabric : ver. 1.0.0-RC1 Release Date : February 17 2015