Interface GridCacheEntryEx

    • Method Detail

      • isInternal

        boolean isInternal()
        Returns:
        True if entry is internal cache entry.
      • isDht

        boolean isDht()
        Returns:
        True if DHT.
      • isNear

        boolean isNear()
        Returns:
        True if near.
      • isReplicated

        boolean isReplicated()
        Returns:
        True if replicated.
      • isLocal

        boolean isLocal()
        Returns:
        True if local.
      • detached

        boolean detached()
        Returns:
        False if entry belongs to cache map, true if this entry was created in colocated cache and node is not primary for this key.
      • deleted

        boolean deleted()
        Note: this method works only for cache configured in ATOMIC mode or for cache that is data center replication target.
        Returns:
        True if entry has been already deleted.
      • partition

        int partition()
        Returns:
        Partition ID.
      • hasValue

        boolean hasValue()
        Returns:
        True if has value or value bytes.
      • rawPut

        CacheObject rawPut​(CacheObject val,
                           long ttl)
        Parameters:
        val - New value.
        ttl - Time to live.
        Returns:
        Old value.
      • wrap

        <K,​V> javax.cache.Cache.Entry<K,​V> wrap()
        Wraps this map entry into cache entry.
        Returns:
        Wrapped entry.
      • wrapLazyValue

        <K,​V> javax.cache.Cache.Entry<K,​V> wrapLazyValue​(boolean keepBinary)
        Wraps entry to an entry with lazy value get.
        Parameters:
        keepBinary - Keep binary flag.
        Returns:
        Entry.
      • peekVisibleValue

        @Nullable
        @Nullable CacheObject peekVisibleValue()
        Peeks value provided to public API entries and to entry filters.
        Returns:
        Value.
      • wrapEviction

        <K,​V> EvictableEntry<K,​V> wrapEviction()
        Returns:
        Entry which is safe to pass into eviction policy.
      • wrapVersioned

        <K,​V> CacheEntryImplEx<K,​V> wrapVersioned()
        Returns:
        Entry which holds key and version (no value, since entry is intended to be used in sync evictions checks).
      • obsoleteVersion

        GridCacheVersion obsoleteVersion()
        Returns:
        Not-null version if entry is obsolete.
      • obsolete

        boolean obsolete()
        Returns:
        True if entry is obsolete.
      • obsoleteOrDeleted

        boolean obsoleteOrDeleted()
        Returns:
        True if entry is obsolete or deleted.
        See Also:
        deleted()
      • obsolete

        boolean obsolete​(GridCacheVersion exclude)
        Parameters:
        exclude - Obsolete version to ignore.
        Returns:
        True if obsolete version is not null and is not the passed in version.
      • onMarkedObsolete

        void onMarkedObsolete()
        This method should be called each time entry is marked obsolete other than by calling markObsolete(GridCacheVersion).
      • valid

        boolean valid​(AffinityTopologyVersion topVer)
        Parameters:
        topVer - Topology version where validation should be performed. When negative the latest available topology should be used.
        Returns:
        Checks if value is valid.
      • partitionValid

        boolean partitionValid()
        Returns:
        True if partition is in valid.
      • innerGet

        CacheObject innerGet​(@Nullable
                             @Nullable GridCacheVersion ver,
                             @Nullable
                             @Nullable IgniteInternalTx tx,
                             boolean readThrough,
                             boolean updateMetrics,
                             boolean evt,
                             Object transformClo,
                             String taskName,
                             @Nullable
                             @Nullable IgniteCacheExpiryPolicy expiryPlc,
                             boolean keepBinary)
                      throws IgniteCheckedException,
                             GridCacheEntryRemovedException
        Parameters:
        ver - Cache version to set. The version will be used on updating entry instead of generated one.
        tx - Ongoing transaction (possibly null).
        readThrough - Flag indicating whether to read through.
        updateMetrics - If true then metrics should be updated.
        evt - Flag to signal event notification.
        transformClo - Transform closure to record event.
        taskName - Task name.
        expiryPlc - Expiry policy.
        keepBinary - Keep binary flag.
        Returns:
        Cached value.
        Throws:
        IgniteCheckedException - If loading value failed.
        GridCacheEntryRemovedException - If entry was removed.
      • clearReserveForLoad

        void clearReserveForLoad​(GridCacheVersion ver)
        Parameters:
        ver - Expected entry version.
      • innerSet

        GridCacheUpdateTxResult innerSet​(@Nullable
                                         @Nullable IgniteInternalTx tx,
                                         UUID evtNodeId,
                                         UUID affNodeId,
                                         @Nullable
                                         @Nullable CacheObject val,
                                         boolean writeThrough,
                                         boolean retval,
                                         long ttl,
                                         boolean evt,
                                         boolean metrics,
                                         boolean keepBinary,
                                         boolean oldValPresent,
                                         @Nullable
                                         @Nullable CacheObject oldVal,
                                         AffinityTopologyVersion topVer,
                                         GridDrType drType,
                                         long drExpireTime,
                                         @Nullable
                                         @Nullable GridCacheVersion explicitVer,
                                         String taskName,
                                         @Nullable
                                         @Nullable GridCacheVersion dhtVer,
                                         @Nullable
                                         @Nullable Long updateCntr)
                                  throws IgniteCheckedException,
                                         GridCacheEntryRemovedException
        Parameters:
        tx - Cache transaction.
        evtNodeId - ID of node responsible for this change.
        affNodeId - Partitioned node iD.
        val - Value to set.
        writeThrough - If true then persist to storage.
        retval - True if value should be returned (and unmarshalled if needed).
        ttl - Time to live.
        evt - Flag to signal event notification.
        metrics - Flag to signal metrics update.
        keepBinary - Keep binary flag.
        oldValPresent - True if oldValue present.
        oldVal - Old value.
        topVer - Topology version.
        drType - DR type.
        drExpireTime - DR expire time (if any).
        explicitVer - Explicit version (if any).
        taskName - Task name.
        dhtVer - Dht version for near cache entry.
        updateCntr - Update counter.
        Returns:
        Tuple containing success flag and old value. If success is false, then value is null.
        Throws:
        IgniteCheckedException - If storing value failed.
        GridCacheEntryRemovedException - If entry has been removed.
      • innerRemove

        GridCacheUpdateTxResult innerRemove​(@Nullable
                                            @Nullable IgniteInternalTx tx,
                                            UUID evtNodeId,
                                            UUID affNodeId,
                                            boolean retval,
                                            boolean evt,
                                            boolean metrics,
                                            boolean keepBinary,
                                            boolean oldValPresent,
                                            @Nullable
                                            @Nullable CacheObject oldVal,
                                            AffinityTopologyVersion topVer,
                                            GridDrType drType,
                                            @Nullable
                                            @Nullable GridCacheVersion explicitVer,
                                            String taskName,
                                            @Nullable
                                            @Nullable GridCacheVersion dhtVer,
                                            @Nullable
                                            @Nullable Long updateCntr)
                                     throws IgniteCheckedException,
                                            GridCacheEntryRemovedException
        Parameters:
        tx - Cache transaction.
        evtNodeId - ID of node responsible for this change.
        affNodeId - Partitioned node iD.
        retval - True if value should be returned (and unmarshalled if needed).
        evt - Flag to signal event notification.
        metrics - Flag to signal metrics notification.
        keepBinary - Keep binary flag.
        oldValPresent - True if oldValue present.
        oldVal - Old value.
        topVer - Topology version.
        drType - DR type.
        explicitVer - Explicit version (if any).
        taskName - Task name.
        dhtVer - Dht version for near cache entry.
        Returns:
        Tuple containing success flag and old value. If success is false, then value is null.
        Throws:
        IgniteCheckedException - If remove failed.
        GridCacheEntryRemovedException - If entry has been removed.
      • innerUpdate

        GridCacheUpdateAtomicResult innerUpdate​(GridCacheVersion ver,
                                                UUID evtNodeId,
                                                UUID affNodeId,
                                                GridCacheOperation op,
                                                @Nullable
                                                @Nullable Object val,
                                                @Nullable
                                                @Nullable Object[] invokeArgs,
                                                boolean writeThrough,
                                                boolean readThrough,
                                                boolean retval,
                                                boolean keepBinary,
                                                @Nullable
                                                @Nullable IgniteCacheExpiryPolicy expiryPlc,
                                                boolean evt,
                                                boolean metrics,
                                                boolean primary,
                                                boolean checkVer,
                                                boolean readRepairRecovery,
                                                AffinityTopologyVersion topVer,
                                                @Nullable
                                                @Nullable CacheEntryPredicate[] filter,
                                                GridDrType drType,
                                                long conflictTtl,
                                                long conflictExpireTime,
                                                @Nullable
                                                @Nullable GridCacheVersion conflictVer,
                                                boolean conflictResolve,
                                                boolean intercept,
                                                String taskName,
                                                @Nullable
                                                @Nullable CacheObject prevVal,
                                                @Nullable
                                                @Nullable Long updateCntr,
                                                @Nullable
                                                @Nullable GridDhtAtomicAbstractUpdateFuture fut,
                                                boolean transformOp)
                                         throws IgniteCheckedException,
                                                GridCacheEntryRemovedException
        Parameters:
        ver - Cache version to set. Entry will be updated only if current version is less then passed version.
        evtNodeId - Event node ID.
        affNodeId - Affinity node ID.
        op - Update operation.
        val - Value. Type depends on operation.
        invokeArgs - Optional arguments for entry processor.
        writeThrough - Write through flag.
        readThrough - Read through flag.
        retval - Return value flag.
        expiryPlc - Expiry policy.
        evt - Event flag.
        metrics - Metrics update flag.
        primary - If update is performed on primary node (the one which assigns version).
        checkVer - Whether update should check current version and ignore update if current version is greater than passed in.
        readRepairRecovery - Recovery on Read Repair.
        topVer - Topology version.
        filter - Optional filter to check.
        drType - DR type.
        conflictTtl - Conflict TTL (if any).
        conflictExpireTime - Conflict expire time (if any).
        conflictVer - DR version (if any).
        conflictResolve - If true then performs conflicts resolution.
        intercept - If true then calls cache interceptor.
        taskName - Task name.
        updateCntr - Update counter.
        fut - Dht atomic future.
        transformOp - True if transform operation caused update.
        Returns:
        Tuple where first value is flag showing whether operation succeeded, second value is old entry value if return value is requested, third is updated entry value, fourth is the version to enqueue for deferred delete the fifth is DR conflict context or null if conflict resolution was not performed, the last boolean - whether update should be propagated to backups or not.
        Throws:
        IgniteCheckedException - If update failed.
        GridCacheEntryRemovedException - If entry is obsolete.
      • clear

        boolean clear​(GridCacheVersion ver,
                      boolean readers)
               throws IgniteCheckedException
        Marks entry as obsolete and, if possible or required, removes it from swap storage.
        Parameters:
        ver - Obsolete version.
        readers - Flag to clear readers as well.
        Returns:
        True if entry was not being used, passed the filter and could be removed.
        Throws:
        IgniteCheckedException - If failed to remove from swap.
      • markObsolete

        boolean markObsolete​(GridCacheVersion ver)
        Sets obsolete flag if possible.
        Parameters:
        ver - Version to set as obsolete.
        Returns:
        True if entry is obsolete, false if entry is still used by other threads or nodes.
      • markObsoleteIfEmpty

        boolean markObsoleteIfEmpty​(@Nullable
                                    @Nullable GridCacheVersion ver)
                             throws IgniteCheckedException
        Sets obsolete flag if entry value is null or entry is expired and no locks are held.
        Parameters:
        ver - Version to set as obsolete.
        Returns:
        True if entry was marked obsolete.
        Throws:
        IgniteCheckedException - If failed.
      • markObsoleteVersion

        boolean markObsoleteVersion​(GridCacheVersion ver)
        Sets obsolete flag if entry version equals to ver.
        Parameters:
        ver - Version to compare with.
        Returns:
        True if marked obsolete.
      • checkSerializableReadVersion

        boolean checkSerializableReadVersion​(GridCacheVersion serReadVer)
                                      throws GridCacheEntryRemovedException
        Checks if there was read/write conflict in serializable transaction.
        Parameters:
        serReadVer - Version read in serializable transaction.
        Returns:
        True if version check passed.
        Throws:
        GridCacheEntryRemovedException - If entry has been removed.
      • hasLockCandidate

        boolean hasLockCandidate​(long threadId)
                          throws GridCacheEntryRemovedException
        Checks if the candidate is either owner or pending.
        Parameters:
        threadId - ThreadId.
        Returns:
        True if the candidate is either owner or pending.
        Throws:
        GridCacheEntryRemovedException - If entry was removed.
      • lockedByThreadUnsafe

        boolean lockedByThreadUnsafe​(long threadId)
        Will not fail for removed entries.
        Parameters:
        threadId - Thread ID to check.
        Returns:
        True if lock is owned by given thread.
      • lockedByUnsafe

        boolean lockedByUnsafe​(GridCacheVersion ver)
        Parameters:
        ver - Version to check for ownership.
        Returns:
        True if owner has the specified version.
      • lockedLocallyUnsafe

        boolean lockedLocallyUnsafe​(GridCacheVersion lockVer)
        Parameters:
        lockVer - Lock ID to check.
        Returns:
        True if lock is owned by candidate.
      • hasLockCandidateUnsafe

        boolean hasLockCandidateUnsafe​(GridCacheVersion ver)
        Parameters:
        ver - Lock version to check.
        Returns:
        True if has candidate with given lock ID.
      • rawExpireTime

        long rawExpireTime()
        Returns:
        Expire time, without accounting for transactions or removals.
      • expireTimeUnlocked

        long expireTimeUnlocked()
        Returns:
        Expiration time. Does not check for entry obsolete flag.
      • onTtlExpired

        boolean onTtlExpired​(GridCacheVersion obsoleteVer)
                      throws GridCacheEntryRemovedException
        Callback from ttl processor to cache entry indicating that entry is expired.
        Parameters:
        obsoleteVer - Version to set obsolete if entry is expired.
        Returns:
        True if this entry was expired as a result of this call.
        Throws:
        GridCacheEntryRemovedException - If entry was removed.
      • rawTtl

        long rawTtl()
        Returns:
        Time to live, without accounting for transactions or removals.
      • hasMeta

        boolean hasMeta​(int key)
        Tests whether or not given metadata is set.
        Parameters:
        key - Key of the metadata to test.
        Returns:
        Whether or not given metadata is set.
      • meta

        @Nullable
        <V> V meta​(int key)
        Gets metadata by key.
        Type Parameters:
        V - Type of the value.
        Parameters:
        key - Metadata key.
        Returns:
        Metadata value or null.
      • addMeta

        @Nullable
        <V> V addMeta​(int key,
                      V val)
        Adds a new metadata.
        Type Parameters:
        V - Type of the value.
        Parameters:
        key - Metadata key.
        val - Metadata value.
        Returns:
        Metadata previously associated with given name, or null if there was none.
      • putMetaIfAbsent

        @Nullable
        <V> V putMetaIfAbsent​(int key,
                              V val)
        Adds given metadata value only if it was absent.
        Type Parameters:
        V - Type of the value.
        Parameters:
        key - Metadata key.
        val - Value to add if it's not attached already.
        Returns:
        null if new value was put, or current value if put didn't happen.
      • replaceMeta

        <V> boolean replaceMeta​(int key,
                                V curVal,
                                V newVal)
        Replaces given metadata with new newVal value only if its current value is equal to curVal. Otherwise, it is no-op.
        Parameters:
        key - Key of the metadata.
        curVal - Current value to check.
        newVal - New value.
        Returns:
        true if replacement occurred, false otherwise.
      • removeMeta

        @Nullable
        <V> V removeMeta​(int key)
        Removes metadata by key.
        Type Parameters:
        V - Type of the value.
        Parameters:
        key - Key of the metadata to remove.
        Returns:
        Value of removed metadata or null.
      • removeMeta

        <V> boolean removeMeta​(int key,
                               V val)
        Removes metadata only if its current value is equal to val passed in.
        Type Parameters:
        V - Value type.
        Parameters:
        key - key of metadata attribute.
        val - Value to compare.
        Returns:
        True if value was removed, false otherwise.
      • lockEntry

        void lockEntry()
        Locks entry to protect from concurrent access. Intended to be used instead of inherent java synchronization. This allows to separate locking from unlocking in time and/or code units.
      • unlockEntry

        void unlockEntry()
        Unlocks entry previously locked by lockEntry().
      • tryLockEntry

        boolean tryLockEntry​(long timeout)
        Locks entry to protect from concurrent access. Intended to be used instead of inherent java synchronization. This allows to separate locking from unlocking in time and/or code units.
        Parameters:
        timeout - period of waiting in millis;
        Returns:
        true if the lock was free and was acquired by the current thread, or the lock was already held by the current thread; and false if the waiting time elapsed before the lock could be acquired
      • lockedByCurrentThread

        boolean lockedByCurrentThread()
        Tests whether the entry is locked currently.
        Returns:
        True if the entry is locked.
      • touch

        void touch()
        Touch this entry in its context's eviction manager.