Module org.eclipse.persistence.core
Class WeakUnitOfWorkIdentityMap
java.lang.Object
org.eclipse.persistence.internal.identitymaps.AbstractIdentityMap
org.eclipse.persistence.internal.identitymaps.FullIdentityMap
org.eclipse.persistence.internal.identitymaps.UnitOfWorkIdentityMap
org.eclipse.persistence.internal.identitymaps.WeakUnitOfWorkIdentityMap
- All Implemented Interfaces:
Serializable
,Cloneable
,IdentityMap
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected int
Keep track of a counter to amortize cleanup of dead cache keysprotected int
PERF: Keep track of a cleanup size to avoid cleanup bottleneck for large caches.protected ReferenceQueue
Fields inherited from class org.eclipse.persistence.internal.identitymaps.FullIdentityMap
cacheKeys
Fields inherited from class org.eclipse.persistence.internal.identitymaps.AbstractIdentityMap
descriptor, isIsolated, maxSize, session
-
Constructor Summary
ConstructorDescriptionWeakUnitOfWorkIdentityMap
(int size, ClassDescriptor descriptor, AbstractSession session, boolean isolated) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Check if garbage collected cache keys need to be cleaned up.protected void
Search for any cache keys that have been garbage collected and remove them.createCacheKey
(Object primaryKey, Object object, Object writeLockValue, long readTime) Create the correct type of CacheKey for this map.protected CacheKey
putCacheKeyIfAbsent
(CacheKey searchKey) Need to check for cleanup on put.Methods inherited from class org.eclipse.persistence.internal.identitymaps.UnitOfWorkIdentityMap
acquireDeferredLock, acquireLock, acquireLockNoWait, acquireLockWithWait, acquireReadLockOnCacheKey, acquireReadLockOnCacheKeyNoWait, getCacheKeyWithReadLock, remove, resetCacheKey, setWriteLockValue
Methods inherited from class org.eclipse.persistence.internal.identitymaps.FullIdentityMap
clone, cloneKeys, collectLocks, elements, getCacheKey, getCacheKeys, getSize, getSize, keys, keys, lazyRelationshipLoaded, put, setCacheKeys
Methods inherited from class org.eclipse.persistence.internal.identitymaps.AbstractIdentityMap
containsKey, get, getAllCacheKeysFromIdentityMapWithEntityPK, getAllFromIdentityMapWithEntityPK, getCacheKeyForLock, getDefaultIdentityMapClass, getDescriptor, getDescriptorClass, getMaxSize, getWrapper, getWriteLockValue, release, remove, setDescriptor, setMaxSize, setWrapper, toString, updateMaxSize
-
Field Details
-
referenceQueue
-
cleanupCount
protected volatile int cleanupCountKeep track of a counter to amortize cleanup of dead cache keys -
cleanupSize
protected volatile int cleanupSizePERF: Keep track of a cleanup size to avoid cleanup bottleneck for large caches.
-
-
Constructor Details
-
WeakUnitOfWorkIdentityMap
public WeakUnitOfWorkIdentityMap(int size, ClassDescriptor descriptor, AbstractSession session, boolean isolated)
-
-
Method Details
-
cleanupDeadCacheKeys
protected void cleanupDeadCacheKeys()Search for any cache keys that have been garbage collected and remove them. This must be done because although the objects held by the cache keys will garbage collect, the keys themselves will not and must be cleaned up. This is a linear operation so is amortized through the cleanupCount to occur only once per cycle averaging to make the total time still constant. -
createCacheKey
public CacheKey createCacheKey(Object primaryKey, Object object, Object writeLockValue, long readTime) Description copied from class:AbstractIdentityMap
Create the correct type of CacheKey for this map.- Overrides:
createCacheKey
in classUnitOfWorkIdentityMap
-
putCacheKeyIfAbsent
Need to check for cleanup on put.- Overrides:
putCacheKeyIfAbsent
in classUnitOfWorkIdentityMap
-
checkCleanup
protected void checkCleanup()Check if garbage collected cache keys need to be cleaned up.
-