Top Description Fields Constructors Methods
org.eclipse.persistence.internal.sessions

public Class IdentityMapAccessor

extends Object
implements IdentityMapAccessor, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, org.eclipse.persistence.sessions.IdentityMapAccessor
Known Direct Subclasses
org.eclipse.persistence.internal.sessions.IsolatedClientSessionIdentityMapAccessor, org.eclipse.persistence.internal.sessions.SessionBrokerIdentityMapAccessor, org.eclipse.persistence.internal.sessions.UnitOfWorkIdentityMapAccessor, org.eclipse.persistence.internal.sessions.ClientSessionIdentityMapAccessor, org.eclipse.persistence.internal.sessions.DistributedSessionIdentityMapAccessor
Imports
java.util.Collection, .Enumeration, .Iterator, .List, .Map, .Vector, org.eclipse.persistence.descriptors.CacheIndex, .ClassDescriptor, org.eclipse.persistence.exceptions.QueryException, .ValidationException, org.eclipse.persistence.expressions.Expression, org.eclipse.persistence.internal.descriptors.DescriptorIterator, org.eclipse.persistence.internal.helper.WriteLockManager, org.eclipse.persistence.internal.identitymaps.CacheId, .CacheKey, .IdentityMap, .IdentityMapManager, org.eclipse.persistence.logging.SessionLog, org.eclipse.persistence.queries.InMemoryQueryIndirectionPolicy, .ReadQuery, org.eclipse.persistence.sessions.DataRecord, .DatabaseRecord, org.eclipse.persistence.sessions.coordination.CommandManager, .MergeChangeSetCommand

INTERNAL: Internal subclass that provides access to identity maps through the session. Implements the IdentityMapAccessor interface which provides all publicly available identity map functionality to users. This is the main class that should be used to access identity maps. In general, any function that accesses the identity map manager should go through this class Any session specific functionality appears in subclasses

Field Summary

Modifier and TypeField and Description
protected IdentityMapManager
identityMapManager

This is the identity map manager for this accessor.

protected AbstractSession

Constructor Summary

AccessConstructor and Description
public
public
IdentityMapAccessor(AbstractSession session)

INTERNAL: An IdentityMapAccessor sits between the session and the identityMapManager It needs references in both directions.

public
IdentityMapAccessor(AbstractSession session, IdentityMapManager identityMapManager)

INTERNAL: An IdentityMapAccessor sits between the session and the identityMapManager It needs references in both directions.

Method Summary

Modifier and TypeMethod and Description
public CacheKey
acquireDeferredLock(Object primarKey, Class<?> javaClass, ClassDescriptor descriptor, boolean isCacheCheckComplete)

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.

public CacheKey
acquireLock(Object primarKey, Class<?> javaClass, ClassDescriptor descriptor, boolean isCacheCheckComplete)

INTERNAL: Lock the identity map for the object, this must be done when building objects.

public CacheKey
acquireLock(Object primaryKey, Class<?> domainClass, boolean forMerge, ClassDescriptor descriptor, boolean isCacheCheckComplete)

INTERNAL: Provides access for setting a concurrency lock on an object in the IdentityMap.

public CacheKey
acquireLockNoWait(Object primaryKey, Class<?> domainClass, boolean forMerge, ClassDescriptor descriptor)

INTERNAL: Provides access for setting a concurrency lock on an object in the IdentityMap.

public CacheKey
acquireLockWithWait(Object primaryKey, Class<?> domainClass, boolean forMerge, ClassDescriptor descriptor, int wait)

INTERNAL: Provides access for setting a concurrency lock on an object in the IdentityMap.

public CacheKey
acquireReadLockOnCacheKey(Object primaryKey, Class<?> domainClass, ClassDescriptor descriptor)

INTERNAL: Find the cachekey for the provided primary key and place a readlock on it.

public CacheKey
acquireReadLockOnCacheKeyNoWait(Object primaryKey, Class<?> domainClass, ClassDescriptor descriptor)

INTERNAL: Find the cachekey for the provided primary key and place a readlock on it.

public boolean
acquireWriteLock()

INTERNAL: Lock the entire cache if the cache isolation requires.

public void
public void
clearQueryCache(ReadQuery query)

Implements org.eclipse.persistence.sessions.IdentityMapAccessor.clearQueryCache.

ADVANCED: Clear the query class associated with the passed-in read query
public void
clearQueryCache(String sessionQueryName)

Implements org.eclipse.persistence.sessions.IdentityMapAccessor.clearQueryCache.

ADVANCED: Clear the query cache associated with the named query on the session
public void
clearQueryCache(String descriptorQueryName, Class<?> queryClass)

Implements org.eclipse.persistence.sessions.IdentityMapAccessor.clearQueryCache.

ADVANCED: Clear the query cache associated with the named query on the descriptor for the given class
public boolean
containsObjectInIdentityMap(Object object)

Implements org.eclipse.persistence.sessions.IdentityMapAccessor.containsObjectInIdentityMap.

ADVANCED: Return if their is an object for the primary key.
public boolean
containsObjectInIdentityMap(Object primaryKey, Class<?> theClass)

Implements org.eclipse.persistence.sessions.IdentityMapAccessor.containsObjectInIdentityMap.

ADVANCED: Return if their is an object for the primary key.
public boolean
containsObjectInIdentityMap(Object primaryKey, Class<?> theClass, ClassDescriptor descriptor)

INTERNAL: Return if their is an object for the primary key.

public boolean
containsObjectInIdentityMap(DataRecord rowContainingPrimaryKey, Class<?> theClass)

Implements org.eclipse.persistence.sessions.IdentityMapAccessor.containsObjectInIdentityMap.

ADVANCED: Return if their is an object for the row containing primary key and the class.
protected Object
extractPrimaryKeyFromRow(DataRecord rowContainingPrimaryKey, Class<?> theClass)

INTERNAL: Extract primary key from a row.

public Map<Object, CacheKey>

Returns:

Map of Entity PKs associated to the Entities that were retrieved
getAllCacheKeysFromIdentityMapWithEntityPK
(Object[]
List of Entity PKs to extract from the cache
pkList
,
ClassDescriptor
Descriptor type to be retrieved.
descriptor
)

ADVANCED: Using a list of Entity PK this method will attempt to bulk load the entire list from the cache.

public Vector<E>
getAllFromIdentityMap(Expression selectionCriteria, Class<?> theClass, DataRecord translationRow)

ADVANCED: Query the cache in-memory.

public Vector<E>
getAllFromIdentityMap(Expression
Expression selecting the Objects to be returned
selectionCriteria
,
Class<?>
Class to be considered
theClass
,
DataRecord
Record
translationRow
,
InMemoryQueryIndirectionPolicy valueHolderPolicy)

Implements org.eclipse.persistence.sessions.IdentityMapAccessor.getAllFromIdentityMap.

ADVANCED: Query the cache in-memory.
public Vector<E>
getAllFromIdentityMap(Expression
Expression selecting the Objects to be returned
selectionCriteria
,
Class<?>
Class to be considered
theClass
,
DataRecord
Record
translationRow
,
int valueHolderPolicy)

Implements org.eclipse.persistence.sessions.IdentityMapAccessor.getAllFromIdentityMap.

ADVANCED: Query the cache in-memory.
public Vector<E>
getAllFromIdentityMap(Expression
Expression selecting the Objects to be returned
selectionCriteria
,
Class<?>
Class to be considered
theClass
,
DataRecord
Record
translationRow
,
InMemoryQueryIndirectionPolicy valueHolderPolicy, boolean
boolean - true if only invalid Objects should be returned
shouldReturnInvalidatedObjects
)

Implements org.eclipse.persistence.sessions.IdentityMapAccessor.getAllFromIdentityMap.

ADVANCED: Query the cache in-memory.
public Vector<E>
getAllFromIdentityMap(Expression
Expression selecting the Objects to be returned
selectionCriteria
,
Class<?>
Class to be considered
theClass
,
DataRecord
Record
translationRow
,
int valueHolderPolicy, boolean
boolean - true if only invalid Objects should be returned
shouldReturnInvalidatedObjects
)

Implements org.eclipse.persistence.sessions.IdentityMapAccessor.getAllFromIdentityMap.

ADVANCED: Query the cache in-memory.
public Map<Object, Object>

Returns:

Map of Entity PKs associated to the Entities that were retrieved
getAllFromIdentityMapWithEntityPK
(Object[]
List of Entity PKs to extract from the cache
pkList
,
ClassDescriptor
Descriptor type to be retrieved.
descriptor
)

ADVANCED: Using a list of Entity PK this method will attempt to bulk load the entire list from the cache.

public CacheKey
getCacheKeyByIndex(CacheIndex index, CacheId indexValues, boolean shouldCheckExpiry, ClassDescriptor descriptor)

Return the cache key for the cache index or null if not found.

public CacheKey
getCacheKeyForObject(Object
the object to get the cache key for.
object
,
ClassDescriptor descriptor)

INTERNAL: Retrieve the cache key for the given object from the identity maps.

public CacheKey

Returns:

CacheKey
getCacheKeyForObject
(Object object)

INTERNAL: Retrieve the cache key for the given object.

public CacheKey
getCacheKeyForObject(Object
the primary key of the cache key to be retrieved.
primaryKey
,
Class<?>
the class of the cache key to be retrieved.
myClass
,
ClassDescriptor descriptor, boolean forMerge)

INTERNAL: Retrieve the cache key for the given identity information.

public CacheKey
getCacheKeyForObjectForLock(Object
the primary key of the cache key to be retrieved.
primaryKey
,
Class<?>
the class of the cache key to be retrieved.
myClass
,
ClassDescriptor descriptor)

INTERNAL: Retrieve the cache key for the given identity information.

public Vector<E>
getClassesRegistered()

INTERNAL: This method is used to get a list of those classes with IdentityMaps in the Session.

public Object
getFromIdentityMap(Object
Object
object
)

Implements org.eclipse.persistence.sessions.IdentityMapAccessor.getFromIdentityMap.

ADVANCED: Return the object from the identity with primary and class of the given object.
public Object
getFromIdentityMap(Object primaryKey, Class<?> theClass)

Implements org.eclipse.persistence.sessions.IdentityMapAccessor.getFromIdentityMap.

ADVANCED: Return the object from the identity with the primary and class.
public Object
getFromIdentityMap(Object primaryKey, Class<?> theClass, ClassDescriptor descriptor)

ADVANCED: Return the object from the identity with the primary and class.

public Object
getFromIdentityMap(Object primaryKey, Class<?> theClass, boolean shouldReturnInvalidatedObjects)

Implements org.eclipse.persistence.sessions.IdentityMapAccessor.getFromIdentityMap.

ADVANCED: Return the object from the identity with the primary and class.
public Object
getFromIdentityMap(Object primaryKey, Object object, Class<?> theClass, boolean shouldReturnInvalidatedObjects, ClassDescriptor descriptor)

INTERNAL: Return the object from the identity with the primary and class.

public Object
getFromIdentityMap(DataRecord
Record
rowContainingPrimaryKey
,
Class<?>
Class
theClass
)

Implements org.eclipse.persistence.sessions.IdentityMapAccessor.getFromIdentityMap.

ADVANCED: Return the object from the identity with the primary and class.
public Object
getFromIdentityMap(DataRecord
Record
rowContainingPrimaryKey
,
Class<?>
Class
theClass
,
boolean
boolean
shouldReturnInvalidatedObjects
)

Implements org.eclipse.persistence.sessions.IdentityMapAccessor.getFromIdentityMap.

ADVANCED: Return the object from the identity with the primary and class.
public Object
getFromIdentityMap(Expression
Expression
selectionCriteria
,
Class<?>
Class
theClass
,
DataRecord
Record
translationRow
)

Implements org.eclipse.persistence.sessions.IdentityMapAccessor.getFromIdentityMap.

ADVANCED: Query the cache in-memory.
public Object
getFromIdentityMap(Expression
Expression
selectionCriteria
,
Class<?>
Class
theClass
,
DataRecord
Record
translationRow
,
InMemoryQueryIndirectionPolicy valueHolderPolicy)

Implements org.eclipse.persistence.sessions.IdentityMapAccessor.getFromIdentityMap.

ADVANCED: Query the cache in-memory.
public Object
getFromIdentityMap(Expression
Expression
selectionCriteria
,
Class<?>
Class
theClass
,
DataRecord
Record
translationRow
,
int valueHolderPolicy)

Implements org.eclipse.persistence.sessions.IdentityMapAccessor.getFromIdentityMap.

ADVANCED: Query the cache in-memory.
public Object
getFromIdentityMap(Expression selectionCriteria, Class<?> theClass, DataRecord translationRow, int valueHolderPolicy, boolean conforming)

INTERNAL: Query the cache in-memory.

public Object
getFromIdentityMap(Expression selectionCriteria, Class<?> theClass, DataRecord translationRow, int valueHolderPolicy, boolean conforming, boolean shouldReturnInvalidatedObjects)

INTERNAL: Query the cache in-memory.

public Object
getFromIdentityMap(Expression selectionCriteria, Class<?> theClass, DataRecord translationRow, int valueHolderPolicy, boolean conforming, boolean shouldReturnInvalidatedObjects, ClassDescriptor descriptor)

INTERNAL: Query the cache in-memory.

public Object
getFromIdentityMapWithDeferredLock(Object primaryKey, Class<?> theClass, ClassDescriptor descriptor)

INTERNAL: Return the object from the identity with the primary and class.

public Object
getFromIdentityMapWithDeferredLock(Object primaryKey, Class<?> theClass, boolean shouldReturnInvalidatedObjects, ClassDescriptor descriptor)

INTERNAL: Return the object from the identity with the primary and class.

public Object
getFromLocalIdentityMap(Object primaryKey, Class<?> theClass, boolean shouldReturnInvalidatedObjects, ClassDescriptor descriptor)

INTERNAL: Return the object from the local identity map with the primary and class.

public Object
getFromLocalIdentityMapWithDeferredLock(Object primaryKey, Class<?> theClass, boolean shouldReturnInvalidatedObjects, ClassDescriptor descriptor)

INTERNAL: Return the object from the local identity map with the primary and class.

public IdentityMap
getIdentityMap(Class<?> theClass)

INTERNAL: (public to allow test cases to check) Return the identity map for the class, if missing create a new one.

public IdentityMap
getIdentityMap(ClassDescriptor descriptor)

INTERNAL: Get the identity map for the given class from the IdentityMapManager

public IdentityMap
getIdentityMap(ClassDescriptor descriptor, boolean returnNullIfMissing)

INTERNAL: Get the identity map for the given class from the IdentityMapManager

public 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.

public Object
getQueryResult(ReadQuery query, List<E> parameters, boolean checkExpiry)

INTERNAL: Get the cached results associated with a query.

public long
getRemainingValidTime(Object
Object under consideration
object
)

Implements org.eclipse.persistence.sessions.IdentityMapAccessor.getRemainingValidTime.

ADVANCED: Return the remaining life of this object.
public AbstractSession
getSession()

INTERNAL: get the session associated with this IdentityMapAccessor

public Object
getWrapper(Object primaryKey, Class<?> theClass)

INTERNAL: Get the wrapper object from the cache key associated with the given primary key, this is used for EJB.

public WriteLockManager
getWriteLockManager()

INTERNAL: Returns the single write Lock manager for this session

public Object
getWriteLockValue(Object
Object
object
)

Implements org.eclipse.persistence.sessions.IdentityMapAccessor.getWriteLockValue.

ADVANCED: Extract the write lock value from the identity map.
public Object
getWriteLockValue(Object primaryKey, Class<?> theClass)

Implements org.eclipse.persistence.sessions.IdentityMapAccessor.getWriteLockValue.

ADVANCED: Extract the write lock value from the identity map.
public Object
getWriteLockValue(Object primaryKey, Class<?> theClass, ClassDescriptor descriptor)

ADVANCED: Extract the write lock value from the identity map.

public void
public void
initializeIdentityMap(Class<?>
Class
theClass
)

Implements org.eclipse.persistence.sessions.IdentityMapAccessor.initializeIdentityMap.

PUBLIC: Reset the identity map for only the instances of the class.
public void
public CacheKey
internalPutInIdentityMap(Object object, Object key, Object writeLockValue, long readTime, ClassDescriptor descriptor)

INTERNAL: Register the object with the cache.

public void
invalidateAll()

Implements org.eclipse.persistence.sessions.IdentityMapAccessor.invalidateAll.

ADVANCED: Set all of the objects from all identity maps to be invalid in the cache.
public void
invalidateClass(Class<?> myClass)

Implements org.eclipse.persistence.sessions.IdentityMapAccessor.invalidateClass.

ADVANCED: Set all of the objects of a specific class to be invalid in the cache.
public void
invalidateClass(Class<?>
- the class where we start invalidation
myClass
,
boolean
- default is true where we invalidate up the inheritance tree to the root descriptor
recurseAndInvalidateToParentRoot
)

Implements org.eclipse.persistence.sessions.IdentityMapAccessor.invalidateClass.

ADVANCED: Set all of the objects of a specific class to be invalid in the cache.
public void
invalidateObject(Object
Object
object
)

Implements org.eclipse.persistence.sessions.IdentityMapAccessor.invalidateObject.

ADVANCED: Set an object to be invalid in the cache.
public void
invalidateObject(Object object, boolean
if true the invalidation will be broadcast to each server in the cluster.
invalidateCluster
)

Implements org.eclipse.persistence.sessions.IdentityMapAccessor.invalidateObject.

ADVANCED: Set an object to be invalid in the cache.
public void
invalidateObject(Object primaryKey, Class<?> theClass)

Implements org.eclipse.persistence.sessions.IdentityMapAccessor.invalidateObject.

ADVANCED: Set an object to be invalid in the cache.
public void
invalidateObject(Object primaryKey, Class<?> theClass, boolean
if true the invalidation will be broadcast to each server in the cluster.
invalidateCluster
)

Implements org.eclipse.persistence.sessions.IdentityMapAccessor.invalidateObject.

ADVANCED: Set an object to be invalid in the cache.
public void
invalidateObject(DataRecord rowContainingPrimaryKey, Class<?> theClass)

Implements org.eclipse.persistence.sessions.IdentityMapAccessor.invalidateObject.

ADVANCED: Set an object to be invalid in the cache.
public void
invalidateObject(DataRecord rowContainingPrimaryKey, Class<?> theClass, boolean
if true the invalidation will be broadcast to each server in the cluster.
invalidateCluster
)

Implements org.eclipse.persistence.sessions.IdentityMapAccessor.invalidateObject.

ADVANCED: Set an object to be invalid in the cache.
public void
invalidateObjects(Expression
Expression
selectionCriteria
)

Implements org.eclipse.persistence.sessions.IdentityMapAccessor.invalidateObjects.

ADVANCED: Set all of the objects from the given Expression to be invalid in the cache.
public void
invalidateObjects(Expression
Expression selecting the Objects to be returned
selectionCriteria
,
Class<?>
Class to be considered
theClass
,
DataRecord
Record
translationRow
,
boolean
boolean indicates weather to invalidate the object if conform threw exception.
shouldInvalidateOnException
)

Implements org.eclipse.persistence.sessions.IdentityMapAccessor.invalidateObjects.

ADVANCED: Queries the cache in-memory with the passed in criteria and invalidates matching Objects.
public void
invalidateObjects(Collection<E>
objects to be invalidated
collection
)

Implements org.eclipse.persistence.sessions.IdentityMapAccessor.invalidateObjects.

ADVANCED: Set all of the objects in the given collection to be invalid in the cache.
public void
invalidateObjects(Collection<E> collection, boolean
if true the invalidation will be broadcast to each server in the cluster.
invalidateCluster
)

Implements org.eclipse.persistence.sessions.IdentityMapAccessor.invalidateObjects.

ADVANCED: Set all of the objects in the given collection to be invalid in the cache.
public void
invalidateQueryCache(Class<?> classThatChanged)

Implements org.eclipse.persistence.sessions.IdentityMapAccessor.invalidateQueryCache.

Invalidate/remove any results for the class from the query cache.
public boolean
isValid(Object object)

Implements org.eclipse.persistence.sessions.IdentityMapAccessor.isValid.

ADVANCED: Return if this object is valid in the cache.
public boolean
isValid(Object primaryKey, Class<?> theClass)

Implements org.eclipse.persistence.sessions.IdentityMapAccessor.isValid.

ADVANCED: Return if this object is valid in the cache.
public boolean
isValid(DataRecord rowContainingPrimaryKey, Class<?> theClass)

Implements org.eclipse.persistence.sessions.IdentityMapAccessor.isValid.

ADVANCED: Return if this object is valid in the cache.
public void
printIdentityMap(Class<?> businessClass)

Implements org.eclipse.persistence.sessions.IdentityMapAccessor.printIdentityMap.

PUBLIC: Used to print all the objects in the identity map of the passed in class.
public void
printIdentityMapLocks()

Implements org.eclipse.persistence.sessions.IdentityMapAccessor.printIdentityMapLocks.

PUBLIC: Used to print all the locks in every identity map in this session.
public void
printIdentityMaps()

Implements org.eclipse.persistence.sessions.IdentityMapAccessor.printIdentityMaps.

PUBLIC: Used to print all the objects in every identity map in this session.
public void
putCacheKeyByIndex(CacheIndex index, CacheId indexValues, CacheKey cacheKey, ClassDescriptor descriptor)

Index the cache key by the index values.

public Object
putInIdentityMap(Object
Object
object
)

Implements org.eclipse.persistence.sessions.IdentityMapAccessor.putInIdentityMap.

ADVANCED: Register the object with the cache.
public Object
putInIdentityMap(Object object, Object key)

Implements org.eclipse.persistence.sessions.IdentityMapAccessor.putInIdentityMap.

ADVANCED: Register the object with the cache.
public Object
putInIdentityMap(Object object, Object key, Object writeLockValue)

Implements org.eclipse.persistence.sessions.IdentityMapAccessor.putInIdentityMap.

ADVANCED: Register the object with the cache.
public Object
putInIdentityMap(Object
Object
object
,
Object
Object
key
,
Object
Object for versioning
writeLockValue
,
long
long, time in milliseconds
readTime
)

Implements org.eclipse.persistence.sessions.IdentityMapAccessor.putInIdentityMap.

ADVANCED: Register the object with the cache.
public Object
putInIdentityMap(Object object, Object key, Object writeLockValue, long readTime, ClassDescriptor descriptor)

ADVANCED: Register the object with the cache.

public void
putQueryResult(ReadQuery query, List<E> parameters, Object results)

INTERNAL: Set the results for a query.

public void
releaseWriteLock()

INTERNAL: Lock the entire cache if the cache isolation requires.

public Object
removeFromIdentityMap(Object
Object
object
)

Implements org.eclipse.persistence.sessions.IdentityMapAccessor.removeFromIdentityMap.

ADVANCED: Remove the object from the object cache.
public Object
removeFromIdentityMap(Object key, Class<?> theClass)

Implements org.eclipse.persistence.sessions.IdentityMapAccessor.removeFromIdentityMap.

ADVANCED: Remove the object from the object cache.
public Object
removeFromIdentityMap(Object key, Class<?> theClass, ClassDescriptor descriptor, Object object)

INTERNAL: Remove the object from the object cache.

public void
setIdentityMapManager(IdentityMapManager identityMapManager)

INTERNAL: Set the IdentityMapManager for this IdentityMapAccessor

public void
setWrapper(Object primaryKey, Class<?> theClass, Object wrapper)

INTERNAL: Update the wrapper object the cache key associated with the given primary key, this is used for EJB.

public void
updateWriteLockValue(Object
Object
object
,
Object
Object for versioning
writeLockValue
)

Implements org.eclipse.persistence.sessions.IdentityMapAccessor.updateWriteLockValue.

ADVANCED: Update the write lock value in the cache.
public void
updateWriteLockValue(Object primaryKey, Class<?> theClass, Object writeLockValue)

Implements org.eclipse.persistence.sessions.IdentityMapAccessor.updateWriteLockValue.

ADVANCED: Update the write lock value in the cache.
public void
validateCache()

Implements org.eclipse.persistence.sessions.IdentityMapAccessor.validateCache.

INTERNAL: This can be used to help debugging an object identity problem.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait