- 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
public class CacheKeyInterceptor extends org.eclipse.persistence.internal.identitymaps.CacheKeyThe 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:
- Serialized Form
- Author:
- Gordon Yorke
-
-
Field Summary
Fields Modifier and Type Field Description protected org.eclipse.persistence.internal.identitymaps.CacheKeywrappedKey-
Fields 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, writeLockValue
-
-
Constructor Summary
Constructors Constructor Description CacheKeyInterceptor(org.eclipse.persistence.internal.identitymaps.CacheKey cacheKey)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidacquire()Acquire the lock on the cache key object.voidacquire(boolean forMerge)Acquire the lock on the cache key object.voidacquireDeferredLock()Acquire the deferred lock.booleanacquireIfUnownedNoWait()Acquire the lock on the cache key object.booleanacquireNoWait()Acquire the lock on the cache key object.booleanacquireNoWait(boolean forMerge)Acquire the lock on the cache key object.voidacquireReadLock()Acquire the read lock on the cache key object.booleanacquireReadLockNoWait()Acquire the read lock on the cache key object.voidcheckDeferredLock()Check the deferred lock on the cache key object.voidcheckReadLock()Check the read lock on the cache key object.Objectclone()INTERNAL: Clones itself.booleanequals(org.eclipse.persistence.internal.identitymaps.CacheKey key)Determine if the receiver is equal to key.ThreadgetActiveThread()Return the active thread.intgetInvalidationState()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.ObjectgetKey()longgetLastUpdatedQueryId()INTERNAL: This method returns the system time in millis seconds at which this object was last refreshed CR #4365 CR #2698903 ...ObjectgetObject()org.eclipse.persistence.internal.identitymaps.IdentityMapgetOwningMap()longgetReadTime()INTERNAL: Return the current value of the Read Time variableDataRecordgetRecord()org.eclipse.persistence.internal.identitymaps.CacheKeygetWrappedCacheKey()If a Wrapper subclasses this CacheKey this method will be used to unwrap the cache key.ObjectgetWrapper()ObjectgetWriteLockValue()inthashCode()Overrides hashCode() in Object to use the primaryKey's hashCode for storage in data structures.booleanisAcquired()Return if a thread has acquire this manager.voidrelease()Release the lock on the cache key object.voidreleaseDeferredLock()Release the deferred lockvoidreleaseReadLock()Release the read lock on the cache key object.ObjectremoveFromOwningMap()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.voidsetKey(Object key)voidsetLastUpdatedQueryId(long id)INTERNAL: This method sets the system time in millis seconds at which this object was last refreshed CR #4365 CR #2698903 ...voidsetObject(Object object)voidsetOwningMap(org.eclipse.persistence.internal.identitymaps.AbstractIdentityMap map)voidsetReadTime(long readTime)INTERNAL: Set the read time of this cache keyvoidsetRecord(DataRecord newDataRecord)voidsetWrapper(Object wrapper)voidsetWriteLockValue(Object writeLockValue)StringtoString()Print the nested depth.voidupdateAccess()Notifies 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, waitForObject
-
Methods inherited from class org.eclipse.persistence.internal.helper.ConcurrencyManager
acquireIfUnownedNoWait, addReadLockToReadLockManager, clearJustificationWhyMethodIsBuildingObjectCompleteReturnsFalse, enrichStringBuildingExplainWhyThreadIsStuckInIsBuildObjectOnThreadComplete, getConcurrencyManagerCreationDate, getConcurrencyManagerId, getDeferredLockManager, getDeferredLockManagers, getDepth, getNumberOfReaders, getNumberOfWritersWaiting, getReadLockManager, getReadLockManagerEnsureResultIsNotNull, getReadLockManagers, getStack, getThreadsToWaitOnAcquire, getThreadsToWaitOnAcquireMethodName, getThreadsToWaitOnAcquireReadLock, getThreadsToWaitOnAcquireReadLockMethodName, getThreadsWaitingToReleaseDeferredLocks, getThreadsWaitingToReleaseDeferredLocksJustification, getTotalNumberOfKeysAcquiredForReading, getTotalNumberOfKeysReleasedForReading, getTotalNumberOfKeysReleasedForReadingBlewUpExceptionDueToCacheKeyHavingReachedCounterZero, initializeDeferredLockManagers, isBuildObjectOnThreadComplete, isLockedByMergeManager, isNested, putDeferredLock, putThreadAsWaitingToAcquireLockForReading, putThreadAsWaitingToAcquireLockForWriting, releaseAllLocksAcquiredByThread, removeDeferredLockManager, removeReadLockFromReadLockManager, removeReadLockManagerIfEmpty, removeThreadNoLongerWaitingToAcquireLockForReading, removeThreadNoLongerWaitingToAcquireLockForWriting, setActiveThread, setDepth, setIsLockedByMergeManager, setJustificationWhyMethodIsBuildingObjectCompleteReturnsFalse, setNumberOfReaders, setNumberOfWritersWaiting, setShouldTrackStack, setStack, shouldTrackStack, transitionToDeferredLock
-
-
-
-
Method Detail
-
acquire
public void acquire()
Acquire the lock on the cache key object.- Overrides:
acquirein classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
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:
acquirein classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
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 classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
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 classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
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 classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
acquireDeferredLock
public void acquireDeferredLock()
Acquire the deferred lock.- Overrides:
acquireDeferredLockin classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
checkReadLock
public void checkReadLock()
Description copied from class:org.eclipse.persistence.internal.identitymaps.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 classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
checkDeferredLock
public void checkDeferredLock()
Description copied from class:org.eclipse.persistence.internal.identitymaps.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 classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
acquireReadLock
public void acquireReadLock()
Acquire the read lock on the cache key object.- Overrides:
acquireReadLockin classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
acquireReadLockNoWait
public boolean acquireReadLockNoWait()
Acquire the read lock on the cache key object.- Overrides:
acquireReadLockNoWaitin classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
getActiveThread
public Thread getActiveThread()
Return the active thread.- Overrides:
getActiveThreadin classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
clone
public Object clone()
Description copied from class:org.eclipse.persistence.internal.identitymaps.CacheKeyINTERNAL: Clones itself.- Overrides:
clonein classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
equals
public boolean equals(org.eclipse.persistence.internal.identitymaps.CacheKey key)
Description copied from class:org.eclipse.persistence.internal.identitymaps.CacheKeyDetermine if the receiver is equal to key. Use an index compare, because it is much faster than enumerations.- Overrides:
equalsin classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
getLastUpdatedQueryId
public long getLastUpdatedQueryId()
Description copied from class:org.eclipse.persistence.internal.identitymaps.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 classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
getKey
public Object getKey()
- Overrides:
getKeyin classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
getObject
public Object getObject()
- Overrides:
getObjectin classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
getOwningMap
public org.eclipse.persistence.internal.identitymaps.IdentityMap getOwningMap()
- Overrides:
getOwningMapin classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
getReadTime
public long getReadTime()
INTERNAL: Return the current value of the Read Time variable- Overrides:
getReadTimein classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
getRecord
public DataRecord getRecord()
- Overrides:
getRecordin classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
getWrappedCacheKey
public org.eclipse.persistence.internal.identitymaps.CacheKey getWrappedCacheKey()
If a Wrapper subclasses this CacheKey this method will be used to unwrap the cache key.- Overrides:
getWrappedCacheKeyin classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
getWrapper
public Object getWrapper()
- Overrides:
getWrapperin classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
getWriteLockValue
public Object getWriteLockValue()
- Overrides:
getWriteLockValuein classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
hashCode
public int hashCode()
Description copied from class:org.eclipse.persistence.internal.identitymaps.CacheKeyOverrides hashCode() in Object to use the primaryKey's hashCode for storage in data structures.- Overrides:
hashCodein classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
isAcquired
public boolean isAcquired()
Description copied from class:org.eclipse.persistence.internal.helper.ConcurrencyManagerReturn if a thread has acquire this manager.- Overrides:
isAcquiredin classorg.eclipse.persistence.internal.helper.ConcurrencyManager
-
getInvalidationState
public int getInvalidationState()
Description copied from class:org.eclipse.persistence.internal.identitymaps.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 classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
release
public void release()
Release the lock on the cache key object.- Overrides:
releasein classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
releaseDeferredLock
public void releaseDeferredLock()
Release the deferred lock- Overrides:
releaseDeferredLockin classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
releaseReadLock
public void releaseReadLock()
Release the read lock on the cache key object.- Overrides:
releaseReadLockin classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
removeFromOwningMap
public Object removeFromOwningMap()
Removes this cacheKey from the owning map- Overrides:
removeFromOwningMapin classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
setInvalidationState
public void setInvalidationState(int invalidationState)
Description copied from class:org.eclipse.persistence.internal.identitymaps.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 classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
setLastUpdatedQueryId
public void setLastUpdatedQueryId(long id)
Description copied from class:org.eclipse.persistence.internal.identitymaps.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 classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
setKey
public void setKey(Object key)
- Overrides:
setKeyin classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
setObject
public void setObject(Object object)
- Overrides:
setObjectin classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
setOwningMap
public void setOwningMap(org.eclipse.persistence.internal.identitymaps.AbstractIdentityMap map)
-
setReadTime
public void setReadTime(long readTime)
Description copied from class:org.eclipse.persistence.internal.identitymaps.CacheKeyINTERNAL: Set the read time of this cache key- Overrides:
setReadTimein classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
setRecord
public void setRecord(DataRecord newDataRecord)
- Overrides:
setRecordin classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
setWrapper
public void setWrapper(Object wrapper)
- Overrides:
setWrapperin classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
setWriteLockValue
public void setWriteLockValue(Object writeLockValue)
- Overrides:
setWriteLockValuein classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
toString
public String toString()
Description copied from class:org.eclipse.persistence.internal.helper.ConcurrencyManagerPrint the nested depth.- Overrides:
toStringin classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
updateAccess
public void updateAccess()
Description copied from class:org.eclipse.persistence.internal.identitymaps.CacheKeyNotifies that cache key that it has been accessed. Allows the LRU sub-cache to be maintained.- Overrides:
updateAccessin classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
-