Module org.eclipse.persistence.core
Class CacheKeyInterceptor
java.lang.Object
org.eclipse.persistence.internal.helper.ConcurrencyManager
org.eclipse.persistence.internal.identitymaps.CacheKey
org.eclipse.persistence.sessions.interceptors.CacheKeyInterceptor
- All Implemented Interfaces:
Serializable,Cloneable
The CacheKeyInterceptor allows a Cache Interceptor implementation to wrap the EclipseLink CacheKey.
The CacheKey is an object that wraps the object and maintains cached based information about the object
like primary key, write lock value and locking. The EclipseLink runtime will access the CacheKey and directly
when releasing locks.
- See Also:
-
Field Summary
FieldsFields inherited from class org.eclipse.persistence.internal.identitymaps.CacheKey
CACHE_KEY_INVALID, CHECK_INVALIDATION_POLICY, CREATION_THREAD_HASHCODE, CREATION_THREAD_ID, CREATION_THREAD_NAME, dataRecord, invalidationState, isIsolated, isWrapper, key, lastUpdatedQueryId, mapOwner, MAX_WAIT_TRIES, object, protectedForeignKeys, readTime, transactionId, wrapper, writeLockValueFields inherited from class org.eclipse.persistence.internal.helper.ConcurrencyManager
activeThread, DEFERRED_LOCK_MANAGERS, depth, lockedByMergeManager, numberOfReaders, numberOfWritersWaiting, shouldTrackStack, stack -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidacquire()Acquire the lock on the cache key object.voidacquire(boolean forMerge) Acquire the lock on the cache key object.voidAcquire the deferred lock.booleanAcquire the lock on the cache key object.booleanAcquire the lock on the cache key object.booleanacquireNoWait(boolean forMerge) Acquire the lock on the cache key object.voidAcquire the read lock on the cache key object.booleanAcquire the read lock on the cache key object.voidCheck the deferred lock on the cache key object.voidCheck the read lock on the cache key object.clone()INTERNAL: Clones itself.booleanDetermine if the receiver is equal to key.Return the active thread.intINTERNAL: 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.getKey()longINTERNAL: This method returns the system time in millis seconds at which this object was last refreshed CR #4365 CR #2698903 ...longINTERNAL: Return the current value of the Read Time variableIf a Wrapper subclasses this CacheKey this method will be used to unwrap the cache key.inthashCode()Overrides hashCode() in Object to use the primaryKey's hashCode for storage in data structures.booleanReturn if a thread has acquire this manager.voidrelease()Release the lock on the cache key object.voidRelease the deferred lockvoidRelease the read lock on the cache key object.Removes this cacheKey from the owning mapvoidsetInvalidationState(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.voidvoidsetLastUpdatedQueryId(long id) INTERNAL: This method sets the system time in millis seconds at which this object was last refreshed CR #4365 CR #2698903 ...voidvoidvoidsetReadTime(long readTime) INTERNAL: Set the read time of this cache keyvoidsetRecord(DataRecord newDataRecord) voidsetWrapper(Object wrapper) voidsetWriteLockValue(Object writeLockValue) toString()Print the nested depth.voidNotifies that cache key that it has been accessed.Methods inherited from class org.eclipse.persistence.internal.identitymaps.CacheKey
acquireLock, acquireWithWait, equals, getProtectedForeignKeys, getTransactionId, hasProtectedForeignKeys, isIsolated, isWrapper, setIsolated, setIsWrapper, setOwningMap, setProtectedForeignKeys, setTransactionId, waitForObjectMethods inherited from class org.eclipse.persistence.internal.helper.ConcurrencyManager
acquireIfUnownedNoWait, addReadLockToReadLockManager, clearJustificationWhyMethodIsBuildingObjectCompleteReturnsFalse, enrichStringBuildingExplainWhyThreadIsStuckInIsBuildObjectOnThreadComplete, getConcurrencyManagerCreationDate, getConcurrencyManagerId, getDeferredLockManager, getDeferredLockManagers, getDeferredLockManagersSnapshot, getDepth, getInstanceLock, getInstanceLockCondition, getNumberOfReaders, getNumberOfWritersWaiting, getReadLockManager, getReadLockManagerEnsureResultIsNotNull, getReadLockManagers, getReadLockManagersSnapshot, getStack, getThreadsToWaitOnAcquireMethodNameSnapshot, getThreadsToWaitOnAcquireReadLockMethodNameSnapshot, getThreadsToWaitOnAcquireReadLockSnapshot, getThreadsToWaitOnAcquireSnapshot, getThreadsWaitingToReleaseDeferredLocksJustificationSnapshot, getThreadsWaitingToReleaseDeferredLocksSnapshot, getTotalNumberOfKeysAcquiredForReading, getTotalNumberOfKeysReleasedForReading, getTotalNumberOfKeysReleasedForReadingBlewUpExceptionDueToCacheKeyHavingReachedCounterZero, initializeDeferredLockManagers, isAcquiredForWritingAndOwnedByDifferentThread, isBuildObjectOnThreadComplete, isLockedByMergeManager, isNested, putDeferredLock, putThreadAsWaitingToAcquireLockForReading, putThreadAsWaitingToAcquireLockForWriting, releaseAllLocksAcquiredByThread, removeDeferredLockManager, removeReadLockFromReadLockManager, removeReadLockManagerIfEmpty, removeThreadNoLongerWaitingToAcquireLockForReading, removeThreadNoLongerWaitingToAcquireLockForWriting, setActiveThread, setDepth, setIsLockedByMergeManager, setJustificationWhyMethodIsBuildingObjectCompleteReturnsFalse, setNumberOfReaders, setNumberOfWritersWaiting, setShouldTrackStack, setStack, shouldTrackStack, transitionToDeferredLock
-
Field Details
-
wrappedKey
-
-
Constructor Details
-
CacheKeyInterceptor
-
-
Method Details
-
acquire
public void acquire()Acquire the lock on the cache key object. -
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 -
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:
acquireNoWaitin classCacheKey
-
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- Overrides:
acquireIfUnownedNoWaitin classCacheKey
-
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:
acquireNoWaitin classCacheKey
-
acquireDeferredLock
public void acquireDeferredLock()Acquire the deferred lock.- Overrides:
acquireDeferredLockin classCacheKey
-
checkReadLock
public void checkReadLock()Description copied from class:CacheKeyCheck 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:
checkReadLockin classCacheKey
-
checkDeferredLock
public void checkDeferredLock()Description copied from class:CacheKeyCheck 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:
checkDeferredLockin classCacheKey
-
acquireReadLock
public void acquireReadLock()Acquire the read lock on the cache key object.- Overrides:
acquireReadLockin classCacheKey
-
acquireReadLockNoWait
public boolean acquireReadLockNoWait()Acquire the read lock on the cache key object.- Overrides:
acquireReadLockNoWaitin classCacheKey
-
getActiveThread
Return the active thread.- Overrides:
getActiveThreadin classCacheKey
-
clone
Description copied from class:CacheKeyINTERNAL: Clones itself. -
equals
Description copied from class:CacheKeyDetermine if the receiver is equal to key. Use an index compare, because it is much faster than enumerations. -
getLastUpdatedQueryId
public long getLastUpdatedQueryId()Description copied from class:CacheKeyINTERNAL: 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.- Overrides:
getLastUpdatedQueryIdin classCacheKey
-
getKey
-
getObject
-
getOwningMap
- Overrides:
getOwningMapin classCacheKey
-
getReadTime
public long getReadTime()INTERNAL: Return the current value of the Read Time variable- Overrides:
getReadTimein classCacheKey
-
getRecord
-
getWrappedCacheKey
If a Wrapper subclasses this CacheKey this method will be used to unwrap the cache key.- Overrides:
getWrappedCacheKeyin classCacheKey
-
getWrapper
- Overrides:
getWrapperin classCacheKey
-
getWriteLockValue
- Overrides:
getWriteLockValuein classCacheKey
-
hashCode
public int hashCode()Description copied from class:CacheKeyOverrides hashCode() in Object to use the primaryKey's hashCode for storage in data structures. -
isAcquired
public boolean isAcquired()Description copied from class:ConcurrencyManagerReturn if a thread has acquire this manager.- Overrides:
isAcquiredin classConcurrencyManager
-
getInvalidationState
public int getInvalidationState()Description copied from class:CacheKeyINTERNAL: 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.- Overrides:
getInvalidationStatein classCacheKey
-
release
public void release()Release the lock on the cache key object. -
releaseDeferredLock
public void releaseDeferredLock()Release the deferred lock- Overrides:
releaseDeferredLockin classCacheKey
-
releaseReadLock
public void releaseReadLock()Release the read lock on the cache key object.- Overrides:
releaseReadLockin classCacheKey
-
removeFromOwningMap
Removes this cacheKey from the owning map- Overrides:
removeFromOwningMapin classCacheKey
-
setInvalidationState
public void setInvalidationState(int invalidationState) Description copied from class:CacheKeyINTERNAL: 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.- Overrides:
setInvalidationStatein classCacheKey
-
setLastUpdatedQueryId
public void setLastUpdatedQueryId(long id) Description copied from class:CacheKeyINTERNAL: 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.- Overrides:
setLastUpdatedQueryIdin classCacheKey
-
setKey
-
setObject
-
setOwningMap
-
setReadTime
public void setReadTime(long readTime) Description copied from class:CacheKeyINTERNAL: Set the read time of this cache key- Overrides:
setReadTimein classCacheKey
-
setRecord
-
setWrapper
- Overrides:
setWrapperin classCacheKey
-
setWriteLockValue
- Overrides:
setWriteLockValuein classCacheKey
-
toString
Description copied from class:ConcurrencyManagerPrint the nested depth. -
updateAccess
public void updateAccess()Description copied from class:CacheKeyNotifies that cache key that it has been accessed. Allows the LRU sub-cache to be maintained.- Overrides:
updateAccessin classCacheKey
-