public class WeakIdentityMap extends FullIdentityMap
Purpose: A WeakIdentityMap holds all objects referenced by the application only. The weak identity map is similar to the full identity map except for the fact that it allows full garbage collection.
Responsibilities:
Modifier and Type | Field and Description |
---|---|
protected int |
cleanupCount
Keep track of a counter to amortize cleanup of dead cache keys
|
protected int |
cleanupSize
PERF: Keep track of a cleanup size to avoid cleanup bottleneck for large caches.
|
cacheKeys
maxSize, searchKey
Constructor and Description |
---|
WeakIdentityMap(int size) |
Modifier and Type | Method and Description |
---|---|
protected void |
cleanupDeadCacheKeys()
Search for any cache keys that have been garbage collected and remove them.
|
CacheKey |
createCacheKey(Vector primaryKey,
Object object,
Object writeLockValue,
long readTime) |
protected int |
getCleanupCount()
Used to amortized the cleanup of dead cache keys.
|
protected int |
getCleanupSize()
Used to amortized the cleanup of dead cache keys.
|
protected void |
put(CacheKey cacheKey)
Store the object in the cache with the cache key.
|
protected void |
setCleanupCount(int cleanupCount) |
protected void |
setCleanupSize(int cleanupSize) |
clone, collectLocks, elements, getCacheKey, getCacheKeys, getSize, getSize, keys, put, remove, resetCacheKey, resetCacheKey, setCacheKeys
acquireDeferredLock, acquireLock, acquireLockNoWait, acquireReadLockOnCacheKey, acquireReadLockOnCacheKeyNoWait, containsKey, createCacheKey, get, getCacheKey, getCacheKeyWithReadLock, getDefaultIdentityMapClass, getMaxSize, getSearchKey, getWrapper, getWriteLockValue, initialize, remove, setMaxSize, setSearchKey, setWrapper, setWriteLockValue, toString, updateCacheKey, updateMaxSize
protected int cleanupCount
protected int cleanupSize
protected void cleanupDeadCacheKeys()
public CacheKey createCacheKey(Vector primaryKey, Object object, Object writeLockValue, long readTime)
createCacheKey
in class IdentityMap
protected int getCleanupCount()
protected void setCleanupCount(int cleanupCount)
protected int getCleanupSize()
protected void setCleanupSize(int cleanupSize)
protected void put(CacheKey cacheKey)
put
in class FullIdentityMap
Copyright © 2021. All rights reserved.