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

public Class FullIdentityMap

extends AbstractIdentityMap
Class Inheritance
Known Direct Subclasses
org.eclipse.persistence.internal.identitymaps.UnitOfWorkIdentityMap, org.eclipse.persistence.internal.identitymaps.WeakIdentityMap, org.eclipse.persistence.internal.identitymaps.CacheIdentityMap
Imports
java.util.*, java.util.concurrent.ConcurrentMap, .ConcurrentHashMap, org.eclipse.persistence.descriptors.ClassDescriptor, org.eclipse.persistence.indirection.ValueHolderInterface, org.eclipse.persistence.internal.sessions.AbstractSession, org.eclipse.persistence.mappings.ForeignReferenceMapping

Purpose: A FullIdentityMap holds all objects stored within it for the life of the application.

Responsibilities:

Since
TOPLink/Java 1.0

Field Summary

Modifier and TypeField and Description
protected Map<Object, CacheKey>
cacheKeys

Map of CacheKeys stored using their key.

Inherited from org.eclipse.persistence.internal.identitymaps.AbstractIdentityMap:
descriptorisIsolatedmaxSizesession

Constructor Summary

AccessConstructor and Description
public
FullIdentityMap()

Used to allow subclasses to build different map type.

public
FullIdentityMap(int size, ClassDescriptor descriptor, AbstractSession session, boolean isolated)

Method Summary

Modifier and TypeMethod and Description
public Object
public Enumeration<CacheKey>

Returns:

Enumeration with clone of the CacheKey Collection
cloneKeys
()

Implements org.eclipse.persistence.internal.identitymaps.IdentityMap.cloneKeys.

Allow for the CacheKey elements to be iterated.
public void
collectLocks(HashMap<K, V> threadList)

Implements abstract org.eclipse.persistence.internal.identitymaps.AbstractIdentityMap.collectLocks.

Implements org.eclipse.persistence.internal.identitymaps.IdentityMap.collectLocks.

INTERNAL: Used to print all the Locks in every identity map in this session.
public Enumeration<E>
public CacheKey
getCacheKey(Object searchKey, boolean forMerge)

Implements abstract org.eclipse.persistence.internal.identitymaps.AbstractIdentityMap.getCacheKey.

Implements org.eclipse.persistence.internal.identitymaps.IdentityMap.getCacheKey.

Return the cache key matching the primary key of the searchKey.
public Map<Object, CacheKey>
getCacheKeys()

Return the cache keys.

public int
public int
getSize(Class<?> myClass, boolean recurse)

Implements abstract org.eclipse.persistence.internal.identitymaps.AbstractIdentityMap.getSize.

Implements org.eclipse.persistence.internal.identitymaps.IdentityMap.getSize.

Return the number of actual objects of type myClass in the IdentityMap.
public Enumeration<CacheKey>
public Enumeration<CacheKey>

Returns:

Enumeration of CacheKey instances.
keys
(boolean
value of true if read lock on the CacheKey instances should be checked or false otherwise
checkReadLocks
)

Implements org.eclipse.persistence.internal.identitymaps.IdentityMap.keys.

Allow for the CacheKey elements to be iterated.
public void
lazyRelationshipLoaded(Object object, ValueHolderInterface<T> valueHolder, ForeignReferenceMapping mapping)

Implements org.eclipse.persistence.internal.identitymaps.IdentityMap.lazyRelationshipLoaded.

Notify the cache that a lazy relationship has been triggered in the object and the cache may need to be updated
public CacheKey
put(Object
is the primary key for the object.
primaryKey
,
Object
is the domain object to cache.
object
,
Object
is the current write lock value of object, if null the version is ignored.
writeLockValue
,
long readTime)

Implements abstract org.eclipse.persistence.internal.identitymaps.AbstractIdentityMap.put.

Implements org.eclipse.persistence.internal.identitymaps.IdentityMap.put.

Store the object in the cache at its primary key.
protected CacheKey
putCacheKeyIfAbsent(CacheKey searchKey)

Implements abstract org.eclipse.persistence.internal.identitymaps.AbstractIdentityMap.putCacheKeyIfAbsent.

Return the CacheKey (with object) matching the searchKey.
public Object

Returns:

the object held within the CacheKey or null if no object cached for given cacheKey.
remove
(CacheKey cacheKey)

Implements abstract org.eclipse.persistence.internal.identitymaps.AbstractIdentityMap.remove.

Implements org.eclipse.persistence.internal.identitymaps.IdentityMap.remove.

Removes the CacheKey from the map.
public void
resetCacheKey(CacheKey key, Object object, Object writeLockValue, long readTime)

Reset the cache key with new data.

protected void
Inherited from org.eclipse.persistence.internal.identitymaps.AbstractIdentityMap:
acquireDeferredLockacquireLockacquireLockNoWaitacquireLockWithWaitacquireReadLockOnCacheKeyacquireReadLockOnCacheKeyNoWaitcontainsKeycreateCacheKeygetgetAllCacheKeysFromIdentityMapWithEntityPKgetAllFromIdentityMapWithEntityPKgetCacheKeyForLockgetCacheKeyWithReadLockgetDefaultIdentityMapClassgetDescriptorgetDescriptorClassgetMaxSizegetWrappergetWriteLockValuereleaseremovesetDescriptorsetMaxSizesetWrappersetWriteLockValuetoStringupdateMaxSize

Field Detail

cacheKeysback to summary
protected Map<Object, CacheKey> cacheKeys

Map of CacheKeys stored using their key.

Constructor Detail

FullIdentityMapback to summary
public FullIdentityMap()

Used to allow subclasses to build different map type.

FullIdentityMapback to summary
public FullIdentityMap(int size, ClassDescriptor descriptor, AbstractSession session, boolean isolated)

Method Detail

cloneback to summary
public Object clone()

Overrides org.eclipse.persistence.internal.identitymaps.AbstractIdentityMap.clone.

Implements org.eclipse.persistence.internal.identitymaps.IdentityMap.clone.

INTERNAL: Clones itself.

Returns:Object

Doc from java.lang.Object.clone.

a clone of this instance.

Annotations
@Override
cloneKeysback to summary
public Enumeration<CacheKey> cloneKeys()

Implements org.eclipse.persistence.internal.identitymaps.IdentityMap.cloneKeys.

Allow for the CacheKey elements to be iterated. Clone of CacheKey Collection is returned so this iteration should be thread safe.

Returns:Enumeration<CacheKey>

Enumeration with clone of the CacheKey Collection

Annotations
@Override
collectLocksback to summary
public void collectLocks(HashMap<K, V> threadList)

Implements abstract org.eclipse.persistence.internal.identitymaps.AbstractIdentityMap.collectLocks.

Implements org.eclipse.persistence.internal.identitymaps.IdentityMap.collectLocks.

INTERNAL: Used to print all the Locks in every identity map in this session.

Annotations
@Override
elementsback to summary
public Enumeration<E> elements()

Implements abstract org.eclipse.persistence.internal.identitymaps.AbstractIdentityMap.elements.

Implements org.eclipse.persistence.internal.identitymaps.IdentityMap.elements.

Allow for the cache CacheKey#getObject() elements to be iterated.

Returns:Enumeration<E>

Enumeration of CacheKey#getObject() instances.

Annotations
@Override
getCacheKeyback to summary
public CacheKey getCacheKey(Object searchKey, boolean forMerge)

Implements abstract org.eclipse.persistence.internal.identitymaps.AbstractIdentityMap.getCacheKey.

Implements org.eclipse.persistence.internal.identitymaps.IdentityMap.getCacheKey.

Return the cache key matching the primary key of the searchKey. If no object for the key exists, return null.

Annotations
@Override
getCacheKeysback to summary
public Map<Object, CacheKey> getCacheKeys()

Return the cache keys.

getSizeback to summary
public int getSize()

Implements abstract org.eclipse.persistence.internal.identitymaps.AbstractIdentityMap.getSize.

Implements org.eclipse.persistence.internal.identitymaps.IdentityMap.getSize.

Return the number of CacheKeys in the IdentityMap. This may contain weak referenced objects that have been garbage collected.

Annotations
@Override
getSizeback to summary
public int getSize(Class<?> myClass, boolean recurse)

Implements abstract org.eclipse.persistence.internal.identitymaps.AbstractIdentityMap.getSize.

Implements org.eclipse.persistence.internal.identitymaps.IdentityMap.getSize.

Return the number of actual objects of type myClass in the IdentityMap. Recurse = true will include subclasses of myClass in the count.

Annotations
@Override
keysback to summary
public Enumeration<CacheKey> keys()

Implements abstract org.eclipse.persistence.internal.identitymaps.AbstractIdentityMap.keys.

Implements org.eclipse.persistence.internal.identitymaps.IdentityMap.keys.

Allow for the cache keys to be iterated on. Read locks will be checked.

Annotations
@Override
keysback to summary
public Enumeration<CacheKey> keys(boolean checkReadLocks)

Implements org.eclipse.persistence.internal.identitymaps.IdentityMap.keys.

Allow for the CacheKey elements to be iterated. CacheKey Collection is reused so this iteration may not be thread safe.

Parameters
checkReadLocks:boolean

value of true if read lock on the CacheKey instances should be checked or false otherwise

Returns:Enumeration<CacheKey>

Enumeration of CacheKey instances.

Annotations
@Override
lazyRelationshipLoadedback to summary
public void lazyRelationshipLoaded(Object object, ValueHolderInterface<T> valueHolder, ForeignReferenceMapping mapping)

Implements org.eclipse.persistence.internal.identitymaps.IdentityMap.lazyRelationshipLoaded.

Notify the cache that a lazy relationship has been triggered in the object and the cache may need to be updated

Annotations
@Override
putback to summary
public CacheKey put(Object primaryKey, Object object, Object writeLockValue, long readTime)

Implements abstract org.eclipse.persistence.internal.identitymaps.AbstractIdentityMap.put.

Implements org.eclipse.persistence.internal.identitymaps.IdentityMap.put.

Store the object in the cache at its primary key. This is used by InsertObjectQuery, typically into the UnitOfWork identity map. Merge and reads do not use put, but acquireLock. Also an advanced (very) user API.

Parameters
primaryKey:Object

is the primary key for the object.

object:Object

is the domain object to cache.

writeLockValue:Object

is the current write lock value of object, if null the version is ignored.

Annotations
@Override
putCacheKeyIfAbsentback to summary
protected CacheKey putCacheKeyIfAbsent(CacheKey searchKey)

Implements abstract org.eclipse.persistence.internal.identitymaps.AbstractIdentityMap.putCacheKeyIfAbsent.

Return the CacheKey (with object) matching the searchKey. If the CacheKey is missing then put the searchKey in the map. The searchKey should have already been locked.

Annotations
@Override
removeback to summary
public Object remove(CacheKey cacheKey)

Implements abstract org.eclipse.persistence.internal.identitymaps.AbstractIdentityMap.remove.

Implements org.eclipse.persistence.internal.identitymaps.IdentityMap.remove.

Removes the CacheKey from the map.

Returns:Object

the object held within the CacheKey or null if no object cached for given cacheKey.

Annotations
@Override
resetCacheKeyback to summary
public void resetCacheKey(CacheKey key, Object object, Object writeLockValue, long readTime)

Reset the cache key with new data.

setCacheKeysback to summary
protected void setCacheKeys(Map<Object, CacheKey> cacheKeys)