org.apache.ignite.internal.processors.cache

## Class GridCacheMvccCandidate

- java.lang.Object
- - org.apache.ignite.internal.processors.cache.GridCacheMvccCandidate

All Implemented Interfaces:
  Externalizable, Serializable, Comparable<GridCacheMvccCandidate>

    public class GridCacheMvccCandidate
    extends Object
    implements Externalizable, Comparable<GridCacheMvccCandidate>

Lock candidate.

See Also:
  Serialized Form

### Constructor Summary

Constructors
Constructor and Description
`GridCacheMvccCandidate()` Empty constructor required by `Externalizable`.
`GridCacheMvccCandidate(GridCacheEntryEx parent, UUID nodeId, UUID otherNodeId, GridCacheVersion otherVer, long threadId, GridCacheVersion ver, long timeout, boolean loc, boolean reentry, boolean tx, boolean singleImplicit, boolean nearLoc, boolean dhtLoc)`

### Method Summary

Methods
`int` `compareTo(GridCacheMvccCandidate o)`
`boolean` `dhtLocal()`
`boolean` `equals(Object o)`
`short` `flags()`
`int` `hashCode()`
`KeyCacheObject` `key()`
`boolean` `local()`
`Collection<ClusterNode>` `mappedDhtNodes()`
`Collection<ClusterNode>` `mappedNearNodes()`
`void` `mappedNodeIds(Collection<ClusterNode> mappedDhtNodes, Collection<ClusterNode> mappedNearNodes)`
`boolean` `matches(GridCacheVersion ver, UUID nodeId, long threadId)` Checks if this candidate matches version or thread-nodeId combination.
`boolean` `nearLocal()`
`GridCacheMvccCandidate` `next()`
`void` `next(GridCacheMvccCandidate next)`
`UUID` `nodeId()`
`UUID` `otherNodeId()`
`void` `otherNodeId(UUID otherNodeId)`
`GridCacheVersion` `otherVersion()`
`boolean` `otherVersion(GridCacheVersion otherVer)` Sets mapped version for candidate.
`boolean` `owner()`
`GridCacheVersion` `ownerVersion()`
`boolean` `ownerVersion(GridCacheVersion ownerVer)` Sets owned version for proper lock ordering when remote candidate is added.
`<V> GridCacheEntryEx` `parent()`
`void` `parent(GridCacheEntryEx parent)`
`GridCacheMvccCandidate` `previous()`
`void` `previous(GridCacheMvccCandidate prev)`
`void` `readExternal(ObjectInput in)`
`boolean` `ready()`
`GridCacheMvccCandidate` `reenter()`
`boolean` `reentry()`
`boolean` `removed()`
`void` `removeMappedNode(ClusterNode node)`
`void` `setOwner()` Sets owner flag.
`void` `setReady()` Sets ready flag.
`void` `setReentry()` Sets reentry flag.
`void` `setRemoved()` Sets removed flag.
`void` `setUsed()` Sets used flag.
`boolean` `singleImplicit()`
`long` `threadId()`
`long` `timeout()`
`long` `timestamp()`
`AffinityTopologyVersion` `topologyVersion()`
`void` `topologyVersion(AffinityTopologyVersion topVer)`
`String` `toString()`
`boolean` `tx()`
`GridCacheMvccCandidate` `unenter()`
`boolean` `used()`
`GridCacheVersion` `version()`
`void` `writeExternal(ObjectOutput out)`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### GridCacheMvccCandidate

    public GridCacheMvccCandidate()

Empty constructor required by `Externalizable`.

#### GridCacheMvccCandidate

    public GridCacheMvccCandidate(GridCacheEntryEx parent,
                          UUID nodeId,
                          @Nullable
                          UUID otherNodeId,
                          @Nullable
                          GridCacheVersion otherVer,
                          long threadId,
                          GridCacheVersion ver,
                          long timeout,
                          boolean loc,
                          boolean reentry,
                          boolean tx,
                          boolean singleImplicit,
                          boolean nearLoc,
                          boolean dhtLoc)

Parameters:
  `parent` - Parent entry.
  `nodeId` - Requesting node ID.
  `otherNodeId` - Near node ID.
  `otherVer` - Other version.
  `threadId` - Requesting thread ID.
  `ver` - Cache version.
  `timeout` - Maximum wait time.
  `loc` - `True` if the lock is local.
  `reentry` - `True` if candidate is for reentry.
  `tx` - Transaction flag.
  `singleImplicit` - Single-key-implicit-transaction flag.
  `nearLoc` - Near-local flag.
  `dhtLoc` - DHT local 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 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 candidates `otherVer` is near local candidate version. For near local candidates `otherVer` is dht mapped candidate version.

Parameters:
  `otherVer` - Alternative candidate version.
Returns:
  `True` if other version was set, `false` if 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:
  `True` if owned version was set, `false` otherwise.

#### ownerVersion

    @Nullable
    public GridCacheVersion ownerVersion()

Returns:
  Version of owned candidate by the time this candidate was added, or `null` if there were no owned candidates.

#### threadId

    public long threadId()

Returns:
  Thread ID.
See Also:
  `Thread.getId()`

#### version

    public GridCacheVersion version()

Returns:
  Lock version.

#### timeout

    public long timeout()

Returns:
  Maximum wait time.

#### timestamp

    public long timestamp()

Returns:
  Timestamp at the time of entering pending set.

#### local

    public boolean local()

Returns:
  `True` if lock is local.

#### tx

    public boolean tx()

Returns:
  `True` if transaction flag is set.

#### singleImplicit

    public boolean singleImplicit()

Returns:
  `True` if implicit transaction.

#### nearLocal

    public boolean nearLocal()

Returns:
  Near local flag.

#### dhtLocal

    public boolean dhtLocal()

Returns:
  Near local flag.

#### reentry

    public boolean reentry()

Returns:
  `True` if 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:
  `True` if 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:
  `True` if is or was an owner.

#### setOwner

    public void setOwner()

Sets owner flag.

#### previous

    public 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, possibly `null`.

#### 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 KeyCacheObject key()

Returns:
  Key.

#### matches

    public boolean matches(GridCacheVersion ver,
                  UUID nodeId,
                  long threadId)

Checks if this candidate matches version or thread-nodeId combination.

Parameters:
  `nodeId` - Node ID to check.
  `ver` - Version to check.
  `threadId` - Thread ID to check.
Returns:
  `True` if matched.

#### writeExternal

    public void writeExternal(ObjectOutput out)
                       throws IOException

Specified by:
  `writeExternal` in interface `Externalizable`
Throws:
  `IOException`

#### readExternal

    public void readExternal(ObjectInput in)
                      throws IOException,
                             ClassNotFoundException

Specified by:
  `readExternal` in interface `Externalizable`
Throws:
  `IOException`
  `ClassNotFoundException`

#### compareTo

    public int compareTo(GridCacheMvccCandidate o)

Specified by:
  `compareTo` in interface `Comparable<GridCacheMvccCandidate>`

#### equals

    public boolean equals(Object o)

Overrides:
  `equals` in class `Object`

#### hashCode

    public int hashCode()

Overrides:
  `hashCode` in class `Object`

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.2.0-incubating
Release Date | : June 16 2015