public class IsolatedClientSessionIdentityMapAccessor extends IdentityMapAccessor
identityMapManager, session
Constructor and Description |
---|
IsolatedClientSessionIdentityMapAccessor(AbstractSession session,
IdentityMapManager identityMapManager)
INTERNAL:
An IdentityMapAccessor sits between the session and the identityMapManager
It needs references in both directions
|
Modifier and Type | Method and Description |
---|---|
CacheKey |
acquireDeferredLock(Vector primaryKey,
Class javaClass,
ClassDescriptor descriptor)
INTERNAL:
Deferred lock the identity map for the object, this is used for avoiding deadlock
The return cacheKey should be used to release the deferred lock
|
CacheKey |
acquireLock(Vector primaryKey,
Class domainClass,
boolean forMerge,
ClassDescriptor descriptor)
INTERNAL:
Provides access for setting a concurrency lock on an object in the IdentityMap.
|
CacheKey |
acquireLockNoWait(Vector primaryKey,
Class domainClass,
boolean forMerge,
ClassDescriptor descriptor)
INTERNAL:
Provides access for setting a concurrency lock on an object in the IdentityMap.
|
CacheKey |
acquireReadLockOnCacheKey(Vector primaryKey,
Class domainClass,
ClassDescriptor descriptor)
INTERNAL:
Find the cachekey for the provided primary key and place a readlock on it.
|
CacheKey |
acquireReadLockOnCacheKeyNoWait(Vector primaryKey,
Class domainClass,
ClassDescriptor descriptor)
INTERNAL:
Find the cachekey for the provided primary key and place a readlock on it.
|
boolean |
acquireWriteLock()
INTERNAL:
Lock the entire cache if the cache isolation requires.
|
boolean |
containsKey(Vector key,
Class theClass,
ClassDescriptor descriptor)
INTERNAL:
Return whether the identity maps contain an item of the given class and key
|
boolean |
containsObjectInIdentityMap(Vector primaryKey,
Class theClass,
ClassDescriptor descriptor)
ADVANCED:
Return if their is an object for the primary key.
|
Vector |
getAllFromIdentityMap(Expression selectionCriteria,
Class theClass,
Record translationRow,
InMemoryQueryIndirectionPolicy valueHolderPolicy,
boolean shouldReturnInvalidatedObjects)
ADVANCED:
Query the cache in-memory.
|
CacheKey |
getCacheKeyForObject(Vector primaryKey,
Class myClass,
ClassDescriptor descriptor)
INTERNAL:
Retrieve the cache key for the given identity information
|
Vector |
getClassesRegistered()
INTERNAL:
This method is used to get a list of those classes with IdentityMaps in the Session.
|
Object |
getFromIdentityMap(Expression selectionCriteria,
Class theClass,
Record translationRow,
InMemoryQueryIndirectionPolicy valueHolderPolicy,
boolean conforming,
boolean shouldReturnInvalidatedObjects,
ClassDescriptor descriptor)
INTERNAL:
Query the cache in-memory.
|
Object |
getFromIdentityMap(Vector primaryKey,
Class theClass,
ClassDescriptor descriptor,
JoinedAttributeManager joinedAttributeManager)
ADVANCED:
Return the object from the identity with the primary and class.
|
Object |
getFromIdentityMapWithDeferredLock(Vector primaryKey,
Class theClass,
boolean shouldReturnInvalidatedObjects,
ClassDescriptor descriptor)
INTERNAL:
Return the object from the identity with the primary and class.
|
IdentityMap |
getIdentityMap(ClassDescriptor descriptor)
INTERNAL:
Get the identity map for the given class from the IdentityMapManager
|
IdentityMapManager |
getIdentityMapManager()
INTERNAL:
Get the IdentityMapManager for this IdentityMapAccessor
This method should be used for all IdentityMapManager access since it may
be overridden in sub classes.
|
long |
getRemainingValidTime(Object object)
ADVANCED:
Return the remaining life of this object.
|
AbstractSession |
getSession()
INTERNAL:
get the session associated with this IdentityMapAccessor
|
Object |
getWrapper(Vector primaryKey,
Class theClass)
INTERNAL:
Get the wrapper object from the cache key associated with the given primary key,
this is used for EJB.
|
WriteLockManager |
getWriteLockManager()
INTERNAL:
Returns the single write Lock manager for this session
|
Object |
getWriteLockValue(Vector primaryKey,
Class theClass,
ClassDescriptor descriptor)
ADVANCED:
Extract the write lock value from the identity map.
|
void |
initializeAllIdentityMaps()
PUBLIC:
Reset the entire object cache.
|
void |
initializeIdentityMap(Class theClass)
PUBLIC:
Reset the identity map for only the instances of the class.
|
void |
initializeIdentityMaps()
PUBLIC:
Reset the entire local object cache.
|
CacheKey |
internalPutInIdentityMap(Object domainObject,
Vector key,
Object writeLockValue,
long readTime,
ClassDescriptor descriptor)
ADVANCED:
Register the object with the identity map.
|
void |
printIdentityMap(Class businessClass)
PUBLIC:
Used to print all the objects in the identity map of the passed in class.
|
void |
printIdentityMapLocks()
PUBLIC:
Used to print all the locks in every identity map in this session.
|
void |
printIdentityMaps()
PUBLIC:
Used to print all the objects in every identity map in this session.
|
void |
releaseWriteLock()
INTERNAL:
Lock the entire cache if the cache isolation requires.
|
Object |
removeFromIdentityMap(Vector key,
Class theClass,
ClassDescriptor descriptor)
ADVANCED:
Remove the object from the object cache.
|
void |
setIdentityMapManager(IdentityMapManager identityMapManager)
INTERNAL:
Set the IdentityMapManager for this IdentityMapAccessor
|
void |
setWrapper(Vector primaryKey,
Class theClass,
Object wrapper)
INTERNAL:
Update the wrapper object the cache key associated with the given primary key,
this is used for EJB.
|
void |
updateWriteLockValue(Vector primaryKey,
Class theClass,
Object writeLockValue)
ADVANCED:
Update the write lock value in the identity map.
|
acquireLock, clearQueryCache, clearQueryCache, clearQueryCache, clearQueryCache, containsObjectInIdentityMap, containsObjectInIdentityMap, containsObjectInIdentityMap, extractPrimaryKeyFromRow, getAllFromIdentityMap, getAllFromIdentityMap, getCacheKeyForObject, getFromIdentityMap, getFromIdentityMap, getFromIdentityMap, getFromIdentityMap, getFromIdentityMap, getFromIdentityMap, getFromIdentityMap, getFromIdentityMap, getFromIdentityMap, getFromIdentityMap, getFromIdentityMapWithDeferredLock, getIdentityMap, getWriteLockValue, getWriteLockValue, invalidateAll, invalidateClass, invalidateClass, invalidateObject, invalidateObject, invalidateObject, invalidateObjects, invalidateObjects, isValid, isValid, isValid, putInIdentityMap, putInIdentityMap, putInIdentityMap, putInIdentityMap, putInIdentityMap, removeFromIdentityMap, removeFromIdentityMap, updateWriteLockValue, validateCache
public IsolatedClientSessionIdentityMapAccessor(AbstractSession session, IdentityMapManager identityMapManager)
public CacheKey acquireDeferredLock(Vector primaryKey, Class javaClass, ClassDescriptor descriptor)
acquireDeferredLock
in class IdentityMapAccessor
public CacheKey acquireLock(Vector primaryKey, Class domainClass, boolean forMerge, ClassDescriptor descriptor)
acquireLock
in class IdentityMapAccessor
IdentityMap#aquire
public CacheKey acquireLockNoWait(Vector primaryKey, Class domainClass, boolean forMerge, ClassDescriptor descriptor)
acquireLockNoWait
in class IdentityMapAccessor
IdentityMap#aquire
public CacheKey acquireReadLockOnCacheKey(Vector primaryKey, Class domainClass, ClassDescriptor descriptor)
acquireReadLockOnCacheKey
in class IdentityMapAccessor
public CacheKey acquireReadLockOnCacheKeyNoWait(Vector primaryKey, Class domainClass, ClassDescriptor descriptor)
acquireReadLockOnCacheKeyNoWait
in class IdentityMapAccessor
public boolean acquireWriteLock()
acquireWriteLock
in class IdentityMapAccessor
public boolean containsKey(Vector key, Class theClass, ClassDescriptor descriptor)
containsKey
in class IdentityMapAccessor
public boolean containsObjectInIdentityMap(Vector primaryKey, Class theClass, ClassDescriptor descriptor)
containsObjectInIdentityMap
in class IdentityMapAccessor
public Vector getClassesRegistered()
getClassesRegistered
in class IdentityMapAccessor
public Vector getAllFromIdentityMap(Expression selectionCriteria, Class theClass, Record translationRow, InMemoryQueryIndirectionPolicy valueHolderPolicy, boolean shouldReturnInvalidatedObjects) throws QueryException
getAllFromIdentityMap
in interface IdentityMapAccessor
getAllFromIdentityMap
in class IdentityMapAccessor
selectionCriteria
- Expression selecting the Objects to be returnedtheClass
- Class to be consideredtranslationRow
- RecordvalueHolderPolicy
- see
InMemoryQueryIndirectionPolicy
shouldReturnInvalidatedObjects
- boolean - true if only invalid Objects should be returnedQueryException
public CacheKey getCacheKeyForObject(Vector primaryKey, Class myClass, ClassDescriptor descriptor)
getCacheKeyForObject
in class IdentityMapAccessor
Vector
- the primary key of the cache key to be retrievedClass
- the class of the cache key to be retrievedpublic Object getFromIdentityMap(Vector primaryKey, Class theClass, ClassDescriptor descriptor, JoinedAttributeManager joinedAttributeManager)
getFromIdentityMap
in class IdentityMapAccessor
public Object getFromIdentityMap(Expression selectionCriteria, Class theClass, Record translationRow, InMemoryQueryIndirectionPolicy valueHolderPolicy, boolean conforming, boolean shouldReturnInvalidatedObjects, ClassDescriptor descriptor)
getFromIdentityMap
in class IdentityMapAccessor
public Object getFromIdentityMapWithDeferredLock(Vector primaryKey, Class theClass, boolean shouldReturnInvalidatedObjects, ClassDescriptor descriptor)
getFromIdentityMapWithDeferredLock
in class IdentityMapAccessor
public IdentityMapManager getIdentityMapManager()
getIdentityMapManager
in class IdentityMapAccessor
public IdentityMap getIdentityMap(ClassDescriptor descriptor)
getIdentityMap
in class IdentityMapAccessor
public long getRemainingValidTime(Object object)
getRemainingValidTime
in interface IdentityMapAccessor
getRemainingValidTime
in class IdentityMapAccessor
object
- Object under considerationpublic AbstractSession getSession()
getSession
in class IdentityMapAccessor
public Object getWrapper(Vector primaryKey, Class theClass)
getWrapper
in class IdentityMapAccessor
public WriteLockManager getWriteLockManager()
getWriteLockManager
in class IdentityMapAccessor
public Object getWriteLockValue(Vector primaryKey, Class theClass, ClassDescriptor descriptor)
getWriteLockValue
in class IdentityMapAccessor
public void initializeAllIdentityMaps()
NOTE: be careful using this method. This method blows away both this session's and its parents caches, this includes the server cache or any other cache. This throws away any objects that have been read in. Extream caution should be used before doing this because object identity will no longer be maintained for any objects currently read in. This should only be called if the application knows that it no longer has references to object held in the cache.
initializeAllIdentityMaps
in interface IdentityMapAccessor
initializeAllIdentityMaps
in class IdentityMapAccessor
public void initializeIdentityMap(Class theClass)
initializeIdentityMap
in interface IdentityMapAccessor
initializeIdentityMap
in class IdentityMapAccessor
theClass
- Classpublic void initializeIdentityMaps()
initializeIdentityMaps
in interface IdentityMapAccessor
initializeIdentityMaps
in class IdentityMapAccessor
public void printIdentityMap(Class businessClass)
printIdentityMap
in interface IdentityMapAccessor
printIdentityMap
in class IdentityMapAccessor
businessClass
- Classpublic void printIdentityMaps()
printIdentityMaps
in interface IdentityMapAccessor
printIdentityMaps
in class IdentityMapAccessor
public void printIdentityMapLocks()
printIdentityMapLocks
in interface IdentityMapAccessor
printIdentityMapLocks
in class IdentityMapAccessor
public CacheKey internalPutInIdentityMap(Object domainObject, Vector key, Object writeLockValue, long readTime, ClassDescriptor descriptor)
internalPutInIdentityMap
in class IdentityMapAccessor
public void releaseWriteLock()
releaseWriteLock
in class IdentityMapAccessor
public Object removeFromIdentityMap(Vector key, Class theClass, ClassDescriptor descriptor)
removeFromIdentityMap
in class IdentityMapAccessor
public void setIdentityMapManager(IdentityMapManager identityMapManager)
setIdentityMapManager
in class IdentityMapAccessor
public void setWrapper(Vector primaryKey, Class theClass, Object wrapper)
setWrapper
in class IdentityMapAccessor
public void updateWriteLockValue(Vector primaryKey, Class theClass, Object writeLockValue)
updateWriteLockValue
in interface IdentityMapAccessor
updateWriteLockValue
in class IdentityMapAccessor
primaryKey
- VectortheClass
- ClasswriteLockValue
- Object for versioningCopyright © 2024. All rights reserved.