|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.ejb.containers.util.cache.BaseCache
com.sun.ejb.containers.util.cache.LruCache
com.sun.ejb.containers.util.cache.FIFOEJBObjectCache
public class FIFOEJBObjectCache
A FIFO EJB(Local)Object cache that maintains reference count
| Nested Class Summary | |
|---|---|
protected static class |
FIFOEJBObjectCache.EJBObjectCacheItem
|
| Nested classes/interfaces inherited from class com.sun.ejb.containers.util.cache.LruCache |
|---|
LruCache.LruCacheItem |
| Nested classes/interfaces inherited from class com.sun.ejb.containers.util.cache.BaseCache |
|---|
BaseCache.CacheItem |
| Field Summary | |
|---|---|
protected static boolean |
_printRefCount
|
protected EJBObjectCacheListener |
listener
|
protected int |
maxCacheSize
|
protected java.lang.String |
name
|
protected java.lang.Object |
refCountLock
|
protected int |
totalRefCount
|
| Fields inherited from class com.sun.ejb.containers.util.cache.LruCache |
|---|
cacheName, head, listSize, NO_TIMEOUT, tail, timeout, trimCount |
| Fields inherited from class com.sun.ejb.containers.util.cache.BaseCache |
|---|
_rb, addCount, addCountLk, bucketLocks, buckets, entryCount, entryCountLk, hitCount, hitCountLk, listeners, maxBuckets, missCount, missCountLk, overflowCount, overflowCountLk, refreshCount, refreshCountLk, refreshFlags, removalCount, removalCountLk, threshold |
| Constructor Summary | |
|---|---|
FIFOEJBObjectCache(java.lang.String name)
default constructor |
|
FIFOEJBObjectCache(java.lang.String name,
long timeout)
constructor with specified timeout |
|
| Method Summary | |
|---|---|
protected BaseCache.CacheItem |
createItem(int hashCode,
java.lang.Object key,
java.lang.Object value,
int size)
create new item |
protected void |
decrementReferenceCount()
|
protected void |
decrementReferenceCount(int count)
|
java.lang.Object |
get(java.lang.Object key)
get the item stored at the key. |
java.lang.Object |
get(java.lang.Object key,
boolean incrementRefCount)
|
java.util.Map |
getStats()
get the stats snapshot |
protected void |
incrementReferenceCount()
|
void |
init(int maxEntries,
int numberOfVictimsToSelect,
long timeout,
float loadFactor,
java.util.Properties props)
|
protected java.lang.Object |
internalGet(int hashCode,
java.lang.Object key,
boolean incrementRefCount)
|
protected java.lang.Object |
internalPut(int hashCode,
java.lang.Object key,
java.lang.Object value,
int size,
boolean incrementRefCount)
|
protected java.lang.Object |
internalRemove(java.lang.Object key,
boolean decrementRefCount)
|
protected boolean |
isThresholdReached()
has cache reached its threshold |
protected void |
itemAccessed(BaseCache.CacheItem item)
this item is accessed |
protected void |
itemRemoved(BaseCache.CacheItem item)
item value has been removed from the cache |
static void |
main(java.lang.String[] args)
|
void |
print()
|
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
cache the given value at the specified key and return previous value |
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value,
boolean incrementRefCount)
|
java.lang.Object |
remove(java.lang.Object key)
remove the item stored at the key. |
java.lang.Object |
remove(java.lang.Object key,
boolean decrementRefCount)
|
void |
setEJBObjectCacheListener(EJBObjectCacheListener listener)
|
void |
trimExpiredEntries(int maxCount)
trim the expired entries from the cache. |
| Methods inherited from class com.sun.ejb.containers.util.cache.LruCache |
|---|
getStatByName, itemAdded, itemRefreshed, setCacheName, trimLru |
| Methods inherited from class com.sun.ejb.containers.util.cache.BaseCache |
|---|
_put, _remove, _removeItem, add, add, addCacheListener, clear, clearStats, contains, decrementEntryCount, destroy, elements, eq, get, getAll, getEntryCount, getIndex, getIndex, handleOverflow, hash, incrementAddCount, incrementEntryCount, incrementHitCount, incrementMissCount, incrementOverflowCount, incrementRefreshCount, incrementRemovalCount, init, init, isEmpty, keys, loadValue, notifyRefresh, put, remove, remove, removeAll, trimItem, values, waitRefresh |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.sun.appserv.util.cache.Cache |
|---|
add, add, addCacheListener, clear, clearStats, contains, destroy, elements, getAll, getEntryCount, getIndex, getStatByName, init, init, isEmpty, keys, notifyRefresh, put, remove, removeAll, values, waitRefresh |
| Field Detail |
|---|
protected int maxCacheSize
protected java.lang.String name
protected EJBObjectCacheListener listener
protected java.lang.Object refCountLock
protected int totalRefCount
protected static boolean _printRefCount
| Constructor Detail |
|---|
public FIFOEJBObjectCache(java.lang.String name)
public FIFOEJBObjectCache(java.lang.String name,
long timeout)
| Method Detail |
|---|
public void init(int maxEntries,
int numberOfVictimsToSelect,
long timeout,
float loadFactor,
java.util.Properties props)
init in interface EJBObjectCachepublic void setEJBObjectCacheListener(EJBObjectCacheListener listener)
setEJBObjectCacheListener in interface EJBObjectCachepublic java.lang.Object get(java.lang.Object key)
BaseCache
get in interface Cacheget in class BaseCachekey - lookup key
public java.lang.Object get(java.lang.Object key,
boolean incrementRefCount)
get in interface EJBObjectCache
public java.lang.Object put(java.lang.Object key,
java.lang.Object value)
BaseCache
put in interface Cacheput in class BaseCachekey - lookup keyvalue - item value to be stored
public java.lang.Object put(java.lang.Object key,
java.lang.Object value,
boolean incrementRefCount)
put in interface EJBObjectCachepublic java.lang.Object remove(java.lang.Object key)
BaseCache
remove in interface Cacheremove in class BaseCachekey - lookup key
public java.lang.Object remove(java.lang.Object key,
boolean decrementRefCount)
remove in interface EJBObjectCacheprotected boolean isThresholdReached()
BaseCache
isThresholdReached in class BaseCacheprotected void itemAccessed(BaseCache.CacheItem item)
LruCache
itemAccessed in class LruCacheitem - CacheItem accessed
Cache bucket is already synchronized by the callerprotected void itemRemoved(BaseCache.CacheItem item)
LruCache
itemRemoved in class LruCacheitem - CacheItem that was just removed
Cache bucket is already synchronized by the caller
protected java.lang.Object internalGet(int hashCode,
java.lang.Object key,
boolean incrementRefCount)
protected java.lang.Object internalPut(int hashCode,
java.lang.Object key,
java.lang.Object value,
int size,
boolean incrementRefCount)
public void print()
protected java.lang.Object internalRemove(java.lang.Object key,
boolean decrementRefCount)
protected BaseCache.CacheItem createItem(int hashCode,
java.lang.Object key,
java.lang.Object value,
int size)
LruCache
createItem in class LruCachehashCode - for the entrykey - Object keyvalue - Object valuesize - size in bytes of the item
subclasses may override to provide their own CacheItem extensions
e.g. one that permits persistence.public java.util.Map getStats()
BaseCache
getStats in interface CachegetStats in class LruCachepublic void trimExpiredEntries(int maxCount)
LruCache
trimExpiredEntries in interface CachetrimExpiredEntries in class LruCachemaxCount - maximum number of invalid entries to trim
specify Integer.MAX_VALUE to trim all invalid entries
This call is to be scheduled by a thread managed by the container.
NOTE: this algorithm assumes that all the entries in the cache have
identical timeout (otherwise traversing from tail won't be right).protected void incrementReferenceCount()
protected void decrementReferenceCount()
protected void decrementReferenceCount(int count)
public static void main(java.lang.String[] args)
throws java.lang.Exception
java.lang.Exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||