Class GridCacheMvccCandidate

    • Constructor Detail

      • GridCacheMvccCandidate

        public GridCacheMvccCandidate()
        Empty constructor required by Externalizable.
      • 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 - 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.
        serOrder - Version for serializable transactions ordering.
        read - Read lock flag.
    • Method Detail

      • flags

        public short flags()
        Returns:
        Flags.
      • topologyVersion

        public AffinityTopologyVersion topologyVersion()
        Returns:
        Topology for which this lock was acquired.
      • topologyVersion

        public void topologyVersion​(AffinityTopologyVersion topVer)
        Parameters:
        topVer - Topology version.
      • 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.
      • removeMappedNode

        public void removeMappedNode​(ClusterNode node)
        Parameters:
        node - Node to remove.
      • 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 @Nullable 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. 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.
      • 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.
      • 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:
        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

        @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.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object