public class LruSessionCache extends LruEJBCache implements EjbCacheStatsProviderDelegate
| Modifier and Type | Class and Description |
|---|---|
protected static class |
LruSessionCache.LruSessionCacheItem |
LruCache.LruCacheItemBaseCache.CacheItem| Modifier and Type | Field and Description |
|---|---|
protected org.glassfish.ha.store.api.BackingStore<Serializable,org.glassfish.ha.store.util.SimpleMetadata> |
backingStore |
protected int |
cacheIdleTimeoutInSeconds |
protected String |
configData |
protected int |
confMaxCacheSize |
protected SFSBContainerCallback |
container |
protected Object |
loadCountLock |
protected int |
loadFromBackupCount |
protected int |
removalTimeoutInSeconds |
protected boolean |
removeIfIdle |
_logger, cacheNamedefaultMaxEntries, head, isUnbounded, listSize, NO_TIMEOUT, tail, timeout, trimCountbucketLocks, buckets, entryCount, hitCount, listeners, maxBuckets, maxEntries, missCount, refreshFlags, removalCount, threshold| Constructor and Description |
|---|
LruSessionCache(String cacheName,
SFSBContainerCallback container,
int cacheIdleTime,
int removalTime) |
| Modifier and Type | Method and Description |
|---|---|
void |
appendStats(StringBuilder sbuf) |
protected BaseCache.CacheItem |
createItem(int hashCode,
Object sessionKey,
Object value,
int size)
create new item
|
void |
destroy()
Destroys all references.
|
boolean |
eligibleForRemovalFromCache(StatefulEJBContext ctx,
Serializable sessionKey)
Called by StatefulSessionContainer before passivation to determine whether
or not removal-timeout has elapsed for a cache item.
|
int |
getCacheHits() |
int |
getCacheMisses() |
int |
getLoadFromBackupCount() |
int |
getMaxCacheSize() |
int |
getNumBeansInCache() |
int |
getNumExpiredSessionsRemoved() |
int |
getNumPassivationErrors() |
int |
getNumPassivations() |
int |
getNumPassivationSuccess() |
int |
getNumVictimsAccessed() |
protected void |
incrementLoadFromBackupCount() |
protected void |
itemAccessed(BaseCache.CacheItem item)
this item is accessed
|
StatefulEJBContext |
lookupEJB(Serializable sessionKey,
SFSBContainerCallback container,
Object cookie) |
boolean |
passivateEJB(StatefulEJBContext ctx,
Serializable sessionKey) |
Object |
remove(Object sessionKey)
remove the item stored at the key.
|
Object |
remove(Object sessionKey,
boolean removeFromStore) |
void |
setBackingStore(org.glassfish.ha.store.api.BackingStore<Serializable,org.glassfish.ha.store.util.SimpleMetadata> store) |
void |
setConfigData(String configData) |
void |
setMaxCacheSize(int val) |
void |
setShutdownState() |
void |
setStatefulSessionStoreMonitor(StatefulSessionStoreMonitor storeMonitor) |
void |
setUndeployedState() |
void |
shutdown() |
protected void |
trimItem(BaseCache.CacheItem item)
trim the item from the cache and notify listeners
|
void |
trimTimedoutItems(int maxTrimCount)
trim the timedOut entries from the cache.
|
void |
trimUnSortedTimedoutItems(int maxCount)
This method picks idle items from a cache which does not have a sorted
LRU list
NRU cache at light loads and FIFO caches do not maintain a LRU list and
hence they have to scan the entire cache and select victims
|
Iterator |
values()
get an Iterator for the values stored in the cache
|
itemAdded, setCacheName, trimLrugetStatByName, getStats, init, itemRefreshed, itemRemoved, setTimeout, trimExpiredEntries_put, _remove, _removeItem, add, add, addCacheListener, clear, clearStats, contains, decrementEntryCount, elements, eq, get, get, getAll, getEntryCount, getIndex, getIndex, handleOverflow, hash, incrementAddCount, incrementEntryCount, incrementHitCount, incrementMissCount, incrementOverflowCount, incrementRefreshCount, incrementRemovalCount, init, init, isEmpty, isThresholdReached, keys, loadValue, notifyRefresh, put, put, remove, remove, removeAll, waitRefreshprotected int cacheIdleTimeoutInSeconds
protected int removalTimeoutInSeconds
protected Object loadCountLock
protected int loadFromBackupCount
protected boolean removeIfIdle
protected SFSBContainerCallback container
protected org.glassfish.ha.store.api.BackingStore<Serializable,org.glassfish.ha.store.util.SimpleMetadata> backingStore
protected String configData
protected int confMaxCacheSize
public LruSessionCache(String cacheName, SFSBContainerCallback container, int cacheIdleTime, int removalTime)
public void destroy()
public void setBackingStore(org.glassfish.ha.store.api.BackingStore<Serializable,org.glassfish.ha.store.util.SimpleMetadata> store)
public void setStatefulSessionStoreMonitor(StatefulSessionStoreMonitor storeMonitor)
protected void trimItem(BaseCache.CacheItem item)
protected void itemAccessed(BaseCache.CacheItem item)
LruCacheitemAccessed in class LruCacheitem - CacheItem accessed
Cache bucket is already synchronized by the callerpublic int getLoadFromBackupCount()
protected void incrementLoadFromBackupCount()
public StatefulEJBContext lookupEJB(Serializable sessionKey, SFSBContainerCallback container, Object cookie)
public Object remove(Object sessionKey)
BaseCachepublic boolean eligibleForRemovalFromCache(StatefulEJBContext ctx, Serializable sessionKey)
public boolean passivateEJB(StatefulEJBContext ctx, Serializable sessionKey) throws NotSerializableException
NotSerializableExceptionpublic void setShutdownState()
public void setUndeployedState()
public Iterator values()
public void shutdown()
public void trimTimedoutItems(int maxTrimCount)
public void trimUnSortedTimedoutItems(int maxCount)
public int getNumVictimsAccessed()
protected BaseCache.CacheItem createItem(int hashCode, Object sessionKey, Object value, int size)
LruCachecreateItem in class LruCachehashCode - for the entrysessionKey - 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 void setConfigData(String configData)
public void appendStats(StringBuilder sbuf)
appendStats in interface StatsProviderpublic int getCacheHits()
getCacheHits in interface EjbCacheStatsProviderDelegatepublic int getCacheMisses()
getCacheMisses in interface EjbCacheStatsProviderDelegatepublic int getNumBeansInCache()
getNumBeansInCache in interface EjbCacheStatsProviderDelegatepublic int getNumExpiredSessionsRemoved()
getNumExpiredSessionsRemoved in interface EjbCacheStatsProviderDelegatepublic int getNumPassivationErrors()
getNumPassivationErrors in interface EjbCacheStatsProviderDelegatepublic int getNumPassivations()
getNumPassivations in interface EjbCacheStatsProviderDelegatepublic int getNumPassivationSuccess()
getNumPassivationSuccess in interface EjbCacheStatsProviderDelegatepublic void setMaxCacheSize(int val)
public int getMaxCacheSize()
getMaxCacheSize in interface EjbCacheStatsProviderDelegateCopyright © 2019. All rights reserved.