Class GridCacheMvccCandidate
- java.lang.Object
-
- org.apache.ignite.internal.processors.cache.GridCacheMvccCandidate
-
- All Implemented Interfaces:
Externalizable,Serializable,Comparable<GridCacheMvccCandidate>,CacheLockCandidates
public class GridCacheMvccCandidate extends Object implements Externalizable, Comparable<GridCacheMvccCandidate>, CacheLockCandidates
Lock candidate.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description GridCacheMvccCandidate()Empty constructor required byExternalizable.GridCacheMvccCandidate(GridCacheEntryEx parent, UUID nodeId, @Nullable UUID otherNodeId, @Nullable GridCacheVersion otherVer, long threadId, GridCacheVersion ver, boolean loc, boolean reentry, boolean tx, boolean singleImplicit, boolean nearLoc, boolean dhtLoc, @Nullable GridCacheVersion serOrder, boolean read)
-
Method Summary
-
-
-
Constructor Detail
-
GridCacheMvccCandidate
public GridCacheMvccCandidate()
Empty constructor required byExternalizable.
-
GridCacheMvccCandidate
public GridCacheMvccCandidate(GridCacheEntryEx parent, UUID nodeId, @Nullable @Nullable UUID otherNodeId, @Nullable @Nullable GridCacheVersion otherVer, long threadId, GridCacheVersion ver, boolean loc, boolean reentry, boolean tx, boolean singleImplicit, boolean nearLoc, boolean dhtLoc, @Nullable @Nullable GridCacheVersion serOrder, boolean read)
- Parameters:
parent- Parent entry.nodeId- Requesting node ID.otherNodeId- Near node ID.otherVer- Other version.threadId- Requesting thread ID.ver- Cache version.loc-Trueif the lock is local.reentry-Trueif candidate is for reentry.tx- Transaction flag.singleImplicit- Single-key-implicit-transaction flag.nearLoc- Near-local flag.dhtLoc- DHT local flag.serOrder- Version for serializable transactions ordering.read- Read lock flag.
-
-
Method Detail
-
flags
public short flags()
- Returns:
- Flags.
-
parent
public <V> GridCacheEntryEx parent()
- Returns:
- Parent entry.
-
topologyVersion
public AffinityTopologyVersion topologyVersion()
- Returns:
- Topology for which this lock was acquired.
-
topologyVersion
public void topologyVersion(AffinityTopologyVersion topVer)
- Parameters:
topVer- Topology version.
-
reenter
public GridCacheMvccCandidate reenter()
- Returns:
- Reentry candidate.
-
unenter
@Nullable public @Nullable GridCacheMvccCandidate unenter()
- Returns:
- Removed reentry candidate or
null.
-
parent
public void parent(GridCacheEntryEx parent)
- Parameters:
parent- Sets locks parent entry.
-
nodeId
public UUID nodeId()
- Returns:
- Node ID.
-
otherNodeId
public UUID otherNodeId()
- Returns:
- Near or DHT node ID.
-
otherNodeId
public void otherNodeId(UUID otherNodeId)
- Parameters:
otherNodeId- Near or DHT node ID.
-
mappedDhtNodes
public Collection<ClusterNode> mappedDhtNodes()
- Returns:
- Mapped node IDs.
-
mappedNearNodes
public Collection<ClusterNode> mappedNearNodes()
- Returns:
- Mapped node IDs.
-
mappedNodeIds
public void mappedNodeIds(Collection<ClusterNode> mappedDhtNodes, Collection<ClusterNode> mappedNearNodes)
- Parameters:
mappedDhtNodes- Mapped DHT node IDs.
-
removeMappedNode
public void removeMappedNode(ClusterNode node)
- Parameters:
node- Node to remove.
-
otherVersion
public GridCacheVersion otherVersion()
- Returns:
- Near version.
-
otherVersion
public boolean otherVersion(GridCacheVersion otherVer)
Sets mapped version for candidate. For dht local candidatesotherVeris near local candidate version. For near local candidatesotherVeris dht mapped candidate version.- Parameters:
otherVer- Alternative candidate version.- Returns:
Trueif other version was set,falseif other version is already set.
-
ownerVersion
public boolean ownerVersion(GridCacheVersion ownerVer)
Sets owned version for proper lock ordering when remote candidate is added.- Parameters:
ownerVer- Version of owned candidate by the moment this candidate was added.- Returns:
Trueif owned version was set,falseotherwise.
-
ownerVersion
@Nullable public @Nullable GridCacheVersion ownerVersion()
- Returns:
- Version of owned candidate by the time this candidate was added, or
nullif there were no owned candidates.
-
threadId
public long threadId()
- Returns:
- Thread ID. Can be outdated for explicit transactions.
- See Also:
Thread.getId()
-
isHeldByThread
public boolean isHeldByThread(long threadId)
Is lock held by the thread.- Parameters:
threadId- Thread id.
-
isHeldByThreadOrVer
public boolean isHeldByThreadOrVer(long threadId, GridCacheVersion ver)Is lock held by the thread or cache version.- Parameters:
threadId- Thread id.ver- Version.
-
hasSameHolderAs
public boolean hasSameHolderAs(GridCacheMvccCandidate other)
Lock has the same holder as other lock.- Parameters:
other- Other lock.
-
version
public GridCacheVersion version()
- Returns:
- Lock version.
-
local
public boolean local()
- Returns:
Trueif lock is local.
-
tx
public boolean tx()
- Returns:
Trueif transaction flag is set.
-
singleImplicit
public boolean singleImplicit()
- Returns:
Trueif implicit transaction.
-
nearLocal
public boolean nearLocal()
- Returns:
- Near local flag.
-
dhtLocal
public boolean dhtLocal()
- Returns:
- Near local flag.
-
serializable
public boolean serializable()
- Returns:
- Serializable transaction flag.
-
serializableOrder
@Nullable public @Nullable GridCacheVersion serializableOrder()
- Returns:
- Version for serializable transactions ordering.
-
read
public boolean read()
- Returns:
- Read lock flag.
-
reentry
public boolean reentry()
- Returns:
Trueif this candidate is a reentry.
-
setReentry
public void setReentry()
Sets reentry flag.
-
ready
public boolean ready()
- Returns:
- Ready flag.
-
setReady
public void setReady()
Sets ready flag.
-
used
public boolean used()
- Returns:
Trueif lock was released.
-
setUsed
public void setUsed()
Sets used flag.
-
removed
public boolean removed()
- Returns:
- Removed flag.
-
setRemoved
public void setRemoved()
Sets removed flag.
-
owner
public boolean owner()
- Returns:
Trueif is or was an owner.
-
setOwner
public void setOwner()
Sets owner flag.
-
previous
@Nullable public @Nullable GridCacheMvccCandidate previous()
- Returns:
- Lock that comes before in the same thread, possibly null.
-
previous
public void previous(GridCacheMvccCandidate prev)
- Parameters:
prev- Lock that comes before in the same thread.
-
next
public GridCacheMvccCandidate next()
- Returns:
- Gets next candidate in this thread.
-
next
public void next(GridCacheMvccCandidate next)
- Parameters:
next- Next candidate in this thread.
-
key
public IgniteTxKey key()
- Returns:
- Key.
-
candidate
public GridCacheMvccCandidate candidate(int idx)
- Specified by:
candidatein interfaceCacheLockCandidates- Parameters:
idx- Candidate index.- Returns:
- Candidate.
-
size
public int size()
- Specified by:
sizein interfaceCacheLockCandidates- Returns:
- Number of candidates.
-
hasCandidate
public boolean hasCandidate(GridCacheVersion ver)
- Specified by:
hasCandidatein interfaceCacheLockCandidates- Parameters:
ver- Candidate version.- Returns:
Trueif contains candidate with given version.
-
writeExternal
public void writeExternal(ObjectOutput out) throws IOException
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
readExternal
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOExceptionClassNotFoundException
-
compareTo
public int compareTo(GridCacheMvccCandidate o)
- Specified by:
compareToin interfaceComparable<GridCacheMvccCandidate>
-
-