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:
java.io.Serializable
,java.lang.Cloneable
public class CacheKeyInterceptor extends org.eclipse.persistence.internal.identitymaps.CacheKey
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:
- Serialized Form
- Author:
- Gordon Yorke
-
-
Field Summary
Fields Modifier and Type Field Description protected org.eclipse.persistence.internal.identitymaps.CacheKey
wrappedKey
-
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, invalidationState, isIsolated, isWrapper, key, lastUpdatedQueryId, mapOwner, MAX_WAIT_TRIES, object, protectedForeignKeys, readTime, record, 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 void
acquire()
Acquire the lock on the cache key object.void
acquire(boolean forMerge)
Acquire the lock on the cache key object.void
acquireDeferredLock()
Acquire the deferred lock.boolean
acquireIfUnownedNoWait()
Acquire the lock on the cache key object.boolean
acquireNoWait()
Acquire the lock on the cache key object.boolean
acquireNoWait(boolean forMerge)
Acquire the lock on the cache key object.void
acquireReadLock()
Acquire the read lock on the cache key object.boolean
acquireReadLockNoWait()
Acquire the read lock on the cache key object.void
checkDeferredLock()
void
checkReadLock()
java.lang.Object
clone()
boolean
equals(org.eclipse.persistence.internal.identitymaps.CacheKey key)
java.lang.Thread
getActiveThread()
Return the active thread.int
getInvalidationState()
java.lang.Object
getKey()
long
getLastUpdatedQueryId()
java.lang.Object
getObject()
org.eclipse.persistence.internal.identitymaps.IdentityMap
getOwningMap()
long
getReadTime()
INTERNAL: Return the current value of the Read Time variableRecord
getRecord()
org.eclipse.persistence.internal.identitymaps.CacheKey
getWrappedCacheKey()
If a Wrapper subclasses this CacheKey this method will be used to unwrap the cache key.java.lang.Object
getWrapper()
java.lang.Object
getWriteLockValue()
int
hashCode()
boolean
isAcquired()
void
release()
Release the lock on the cache key object.void
releaseDeferredLock()
Release the deferred lockvoid
releaseReadLock()
Release the read lock on the cache key object.java.lang.Object
removeFromOwningMap()
Removes this cacheKey from the owning mapvoid
setInvalidationState(int invalidationState)
void
setKey(java.lang.Object key)
void
setLastUpdatedQueryId(long id)
void
setObject(java.lang.Object object)
void
setOwningMap(org.eclipse.persistence.internal.identitymaps.AbstractIdentityMap map)
void
setReadTime(long readTime)
void
setRecord(Record newRecord)
void
setWrapper(java.lang.Object wrapper)
void
setWriteLockValue(java.lang.Object writeLockValue)
java.lang.String
toString()
void
updateAccess()
-
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, getInstanceLock, getInstanceLockCondition, 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:
acquire
in 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:
acquire
in 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:
acquireNoWait
in 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:
acquireIfUnownedNoWait
in 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:
acquireNoWait
in classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
acquireDeferredLock
public void acquireDeferredLock()
Acquire the deferred lock.- Overrides:
acquireDeferredLock
in classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
checkReadLock
public void checkReadLock()
- Overrides:
checkReadLock
in classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
checkDeferredLock
public void checkDeferredLock()
- Overrides:
checkDeferredLock
in classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
acquireReadLock
public void acquireReadLock()
Acquire the read lock on the cache key object.- Overrides:
acquireReadLock
in classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
acquireReadLockNoWait
public boolean acquireReadLockNoWait()
Acquire the read lock on the cache key object.- Overrides:
acquireReadLockNoWait
in classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
getActiveThread
public java.lang.Thread getActiveThread()
Return the active thread.- Overrides:
getActiveThread
in classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
clone
public java.lang.Object clone()
- Overrides:
clone
in classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
equals
public boolean equals(org.eclipse.persistence.internal.identitymaps.CacheKey key)
- Overrides:
equals
in classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
getLastUpdatedQueryId
public long getLastUpdatedQueryId()
- Overrides:
getLastUpdatedQueryId
in classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
getKey
public java.lang.Object getKey()
- Overrides:
getKey
in classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
getObject
public java.lang.Object getObject()
- Overrides:
getObject
in classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
getOwningMap
public org.eclipse.persistence.internal.identitymaps.IdentityMap getOwningMap()
- Overrides:
getOwningMap
in classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
getReadTime
public long getReadTime()
INTERNAL: Return the current value of the Read Time variable- Overrides:
getReadTime
in classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
getRecord
public Record getRecord()
- Overrides:
getRecord
in 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:
getWrappedCacheKey
in classorg.eclipse.persistence.internal.identitymaps.CacheKey
- Returns:
-
getWrapper
public java.lang.Object getWrapper()
- Overrides:
getWrapper
in classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
getWriteLockValue
public java.lang.Object getWriteLockValue()
- Overrides:
getWriteLockValue
in classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
isAcquired
public boolean isAcquired()
- Overrides:
isAcquired
in classorg.eclipse.persistence.internal.helper.ConcurrencyManager
-
getInvalidationState
public int getInvalidationState()
- Overrides:
getInvalidationState
in classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
release
public void release()
Release the lock on the cache key object.- Overrides:
release
in classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
releaseDeferredLock
public void releaseDeferredLock()
Release the deferred lock- Overrides:
releaseDeferredLock
in classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
releaseReadLock
public void releaseReadLock()
Release the read lock on the cache key object.- Overrides:
releaseReadLock
in classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
removeFromOwningMap
public java.lang.Object removeFromOwningMap()
Removes this cacheKey from the owning map- Overrides:
removeFromOwningMap
in classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
setInvalidationState
public void setInvalidationState(int invalidationState)
- Overrides:
setInvalidationState
in classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
setLastUpdatedQueryId
public void setLastUpdatedQueryId(long id)
- Overrides:
setLastUpdatedQueryId
in classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
setKey
public void setKey(java.lang.Object key)
- Overrides:
setKey
in classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
setObject
public void setObject(java.lang.Object object)
- Overrides:
setObject
in classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
setOwningMap
public void setOwningMap(org.eclipse.persistence.internal.identitymaps.AbstractIdentityMap map)
-
setReadTime
public void setReadTime(long readTime)
- Overrides:
setReadTime
in classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
setRecord
public void setRecord(Record newRecord)
- Overrides:
setRecord
in classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
setWrapper
public void setWrapper(java.lang.Object wrapper)
- Overrides:
setWrapper
in classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
setWriteLockValue
public void setWriteLockValue(java.lang.Object writeLockValue)
- Overrides:
setWriteLockValue
in classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
toString
public java.lang.String toString()
- Overrides:
toString
in classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
updateAccess
public void updateAccess()
- Overrides:
updateAccess
in classorg.eclipse.persistence.internal.identitymaps.CacheKey
-
-