Methods Summary |
---|
protected void | cleanupDeadCacheKeys()Search for any cache keys that have been garbage collected and remove them.
This must be done because allthough the objects held by the cache keys will garbage collect,
the keys themselves will not and must be cleaned up. This is a linear opperation so
is amortized through the cleanupCount to occur only once per cycle avergaing to make
the total time still constant.
for (Enumeration keysEnum = getCacheKeys().elements(); keysEnum.hasMoreElements();) {
CacheKey key = (CacheKey)keysEnum.nextElement();
if (key.getObject() == null) {
// Check lock first.
//Change for CR 2317
if (key.acquireNoWait()) {
try {
if (key.getObject() == null) {
getCacheKeys().remove(key);
}
} finally {
key.release();
}
}
//change complete CR 2317
}
}
|
public oracle.toplink.essentials.internal.identitymaps.CacheKey | createCacheKey(java.util.Vector primaryKey, java.lang.Object object, java.lang.Object writeLockValue, long readTime)
return new WeakCacheKey(primaryKey, object, writeLockValue, readTime);
|
protected int | getCleanupCount()Used to amortized the cleanup of dead cache keys.
return cleanupCount;
|
protected int | getCleanupSize()Used to amortized the cleanup of dead cache keys.
return cleanupSize;
|
protected void | put(oracle.toplink.essentials.internal.identitymaps.CacheKey cacheKey)Store the object in the cache with the cache key.
//CR3712 Add the method back.
synchronized (this) {
if (getCleanupCount() > getCleanupSize()) {
cleanupDeadCacheKeys();
setCleanupCount(0);
// PERF: Avoid cleanup bottleneck for large cache sizes, increase next cleanup.
if (getSize() > getCleanupSize()) {
setCleanupSize(getSize());
}
}
setCleanupCount(getCleanupCount() + 1);
}
super.put(cacheKey);
|
protected void | setCleanupCount(int cleanupCount)
this.cleanupCount = cleanupCount;
|
protected void | setCleanupSize(int cleanupSize)
this.cleanupSize = cleanupSize;
|