Class CacheKey

    • Field Detail

      • CREATION_THREAD_ID

        public final long CREATION_THREAD_ID
      • CREATION_THREAD_NAME

        public final String CREATION_THREAD_NAME
      • CREATION_THREAD_HASHCODE

        public final long CREATION_THREAD_HASHCODE
      • key

        protected Object key
        The key holds the vector of primary key values for the object.
      • object

        protected Object object
      • writeLockValue

        protected Object writeLockValue
        The writeLock value is being held as an object so that it might contain a number or timestamp.
      • wrapper

        protected Object wrapper
        The cached wrapper for the object, used in EJB.
      • record

        protected Record record
        This is used for Document Preservation to cache the record that this object was built from
      • lastUpdatedQueryId

        protected long lastUpdatedQueryId
        This attribute is the system time in milli seconds that the object was last refreshed on
      • invalidationState

        protected int invalidationState
        Invalidation State can be used to indicate whether this cache key is considered valid
      • CHECK_INVALIDATION_POLICY

        public static final int CHECK_INVALIDATION_POLICY
        The following constants are used for the invalidationState variable
        See Also:
        Constant Field Values
      • readTime

        protected long readTime
        The read time stores the millisecond value of the last time the object help by this cache key was confirmed as up to date.
      • isWrapper

        protected boolean isWrapper
        Stores if this CacheKey instance is a wrapper for the underlying CacheKey. CacheKey wrappers may be used with cache interceptors.
      • protectedForeignKeys

        protected AbstractRecord protectedForeignKeys
        Stores retrieved FK values for relationships that are not stored in the Entity
      • isIsolated

        protected boolean isIsolated
        Set to true if this CacheKey comes from an IsolatedClientSession, or DatabaseSessionImpl.
      • transactionId

        protected Object transactionId
        The ID of the database transaction that last wrote the object. This is used for database change notification.
    • Constructor Detail

      • CacheKey

        protected CacheKey()
        Internal: Only used by subclasses that may want to wrap the cache key. Could be replaced by switching to an interface.
      • CacheKey

        public CacheKey​(Object primaryKey)
      • CacheKey

        public CacheKey​(Object primaryKey,
                        Object object,
                        Object lockValue,
                        long readTime,
                        boolean isIsolated)
    • Method Detail

      • acquire

        public void acquire​(boolean forMerge)
        Acquire the lock on the cache key object. For the merge process called with true from the merge process, if true then the refresh will not refresh the object
        Overrides:
        acquire in class ConcurrencyManager
      • acquireNoWait

        public boolean acquireNoWait()
        Acquire the lock on the cache key object. But only if the object has no lock on it Added for CR 2317
        Overrides:
        acquireNoWait in class ConcurrencyManager
      • acquireIfUnownedNoWait

        public boolean acquireIfUnownedNoWait()
        Acquire the lock on the cache key object. Only acquire a lock if the cache key's active thread is not set. Added for Bug 5840635
      • acquireNoWait

        public boolean acquireNoWait​(boolean forMerge)
        Acquire the lock on the cache key object. But only if the object has no lock on it Added for CR 2317 called with true from the merge process, if true then the refresh will not refresh the object
        Overrides:
        acquireNoWait in class ConcurrencyManager
      • acquireWithWait

        public boolean acquireWithWait​(boolean forMerge,
                                       int wait)
        Acquire the lock on the cache key object. But only if the object has no lock on it Added for CR 2317 called with true from the merge process, if true then the refresh will not refresh the object
        Overrides:
        acquireWithWait in class ConcurrencyManager
      • checkReadLock

        public void checkReadLock()
        Check the read lock on the cache key object. This can be called to ensure the cache key has a valid built object. It does not hold a lock, so the object could be refreshed afterwards.
        Overrides:
        checkReadLock in class ConcurrencyManager
      • checkDeferredLock

        public void checkDeferredLock()
        Check the deferred lock on the cache key object. This can be called to ensure the cache key has a valid built object. It does not hold a lock, so the object could be refreshed afterwards.
        Overrides:
        checkDeferredLock in class ConcurrencyManager
      • acquireReadLockNoWait

        public boolean acquireReadLockNoWait()
        Acquire the read lock on the cache key object. Return true if acquired.
        Overrides:
        acquireReadLockNoWait in class ConcurrencyManager
      • clone

        public Object clone()
        INTERNAL: Clones itself.
        Overrides:
        clone in class Object
      • equals

        public boolean equals​(Object object)
        Determine if the receiver is equal to anObject. If anObject is a CacheKey, do further comparison, otherwise, return false.
        Overrides:
        equals in class Object
        See Also:
        equals(CacheKey)
      • equals

        public boolean equals​(CacheKey key)
        Determine if the receiver is equal to key. Use an index compare, because it is much faster than enumerations.
      • getLastUpdatedQueryId

        public long getLastUpdatedQueryId()
        INTERNAL: This method returns the system time in millis seconds at which this object was last refreshed CR #4365 CR #2698903 ... instead of using millis we will now use id's instead. Method renamed appropriately.
      • getKey

        public Object getKey()
      • getObject

        public Object getObject()
      • getReadTime

        public long getReadTime()
        INTERNAL: Return the current value of the Read Time variable
      • getRecord

        public Record getRecord()
      • getWrapper

        public Object getWrapper()
      • getWrappedCacheKey

        public CacheKey getWrappedCacheKey()
        If a Wrapper subclasses this CacheKey this method will be used to unwrap the cache key.
        Returns:
      • getWriteLockValue

        public Object getWriteLockValue()
      • hashCode

        public int hashCode()
        Overrides hashCode() in Object to use the primaryKey's hashCode for storage in data structures.
        Overrides:
        hashCode in class Object
      • hasProtectedForeignKeys

        public boolean hasProtectedForeignKeys()
        Returns true if the protectedForeignKeys record is non-null and non-empty, false otherwise.
      • isIsolated

        public boolean isIsolated()
        Returns true if this CacheKey is from an IsolatedClientSession
      • isWrapper

        public boolean isWrapper()
        Returns true if this Instance of CacheKey is a wrapper and should be unwrapped before passing to IdentityMap APIs. Wrapped CacheKeys may be used in the Cache Interceptors.
      • getProtectedForeignKeys

        public AbstractRecord getProtectedForeignKeys()
        INTERNAL: Return the FK cache
      • getInvalidationState

        public int getInvalidationState()
        INTERNAL: Return the value of the invalidationState Variable The return value will be a constant CHECK_INVALIDATION_POLICY - The Invalidation policy is must be checked for this cache key's sate CACHE_KEY_INVALID - This cache key has been labeled invalid.
      • removeFromOwningMap

        public Object removeFromOwningMap()
        Removes this cacheKey from the owning map
      • setInvalidationState

        public void setInvalidationState​(int invalidationState)
        INTERNAL: Set the value of the invalidationState Variable The possible values are from an enumeration of constants CHECK_INVALIDATION_POLICY - The invalidation policy is must be checked for this cache key's sate CACHE_KEY_INVALID - This cache key has been labelled invalid.
      • setLastUpdatedQueryId

        public void setLastUpdatedQueryId​(long id)
        INTERNAL: This method sets the system time in millis seconds at which this object was last refreshed CR #4365 CR #2698903 ... instead of using millis we will now use ids instead. Method renamed appropriately.
      • setKey

        public void setKey​(Object key)
      • setObject

        public void setObject​(Object object)
      • setOwningMap

        public void setOwningMap​(IdentityMap map)
      • setProtectedForeignKeys

        public void setProtectedForeignKeys​(AbstractRecord protectedForeignKeys)
      • setReadTime

        public void setReadTime​(long readTime)
        INTERNAL: Set the read time of this cache key
      • setRecord

        public void setRecord​(Record newRecord)
      • setWrapper

        public void setWrapper​(Object wrapper)
      • setWriteLockValue

        public void setWriteLockValue​(Object writeLockValue)
      • updateAccess

        public void updateAccess()
        Notifies that cache key that it has been accessed. Allows the LRU sub-cache to be maintained.
      • setIsolated

        public void setIsolated​(boolean isIsolated)
      • setIsWrapper

        public void setIsWrapper​(boolean isWrapper)
      • getTransactionId

        public Object getTransactionId()
      • setTransactionId

        public void setTransactionId​(Object transactionId)
      • waitForObject

        public Object waitForObject()