Class LruSessionCache
java.lang.Object
com.sun.appserv.util.cache.BaseCache
com.sun.appserv.util.cache.LruCache
com.sun.ejb.containers.util.cache.LruEJBCache
com.sun.ejb.containers.util.cache.LruSessionCache
- All Implemented Interfaces:
com.sun.appserv.util.cache.Cache,EjbCacheStatsProviderDelegate,StatsProvider
- Direct Known Subclasses:
FIFOSessionCache,NRUSessionCache,UnBoundedSessionCache
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class com.sun.appserv.util.cache.LruCache
com.sun.appserv.util.cache.LruCache.LruCacheItemNested classes/interfaces inherited from class com.sun.appserv.util.cache.BaseCache
com.sun.appserv.util.cache.BaseCache.CacheItem -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.glassfish.ha.store.api.BackingStore<Serializable, org.glassfish.ha.store.util.SimpleMetadata> protected intprotected Stringprotected intprotected SFSBContainerCallbackprotected Objectprotected intprotected intprotected booleanFields inherited from class com.sun.ejb.containers.util.cache.LruEJBCache
_logger, cacheNameFields inherited from class com.sun.appserv.util.cache.LruCache
defaultMaxEntries, head, isUnbounded, listSize, NO_TIMEOUT, tail, timeout, trimCountFields inherited from class com.sun.appserv.util.cache.BaseCache
bucketLocks, buckets, entryCount, hitCount, listeners, maxBuckets, maxEntries, missCount, refreshFlags, removalCount, threshold -
Constructor Summary
ConstructorsConstructorDescriptionLruSessionCache(String cacheName, SFSBContainerCallback container, int cacheIdleTime, int removalTime) -
Method Summary
Modifier and TypeMethodDescriptionvoidappendStats(StringBuffer sbuf) protected com.sun.appserv.util.cache.BaseCache.CacheItemcreateItem(int hashCode, Object sessionKey, Object value, int size) voiddestroy()Destroys all references.booleaneligibleForRemovalFromCache(StatefulEJBContext ctx, Serializable sessionKey) Called by StatefulSessionContainer before passivation to determine whether or not removal-timeout has elapsed for a cache item.intintintintintintintintintintprotected voidprotected voiditemAccessed(com.sun.appserv.util.cache.BaseCache.CacheItem item) lookupEJB(Serializable sessionKey, SFSBContainerCallback container, Object cookie) booleanpassivateEJB(StatefulEJBContext ctx, Serializable sessionKey) voidsetBackingStore(org.glassfish.ha.store.api.BackingStore<Serializable, org.glassfish.ha.store.util.SimpleMetadata> store) voidsetConfigData(String configData) voidsetMaxCacheSize(int val) voidvoidsetStatefulSessionStoreMonitor(StatefulSessionStoreMonitor storeMonitor) voidvoidshutdown()protected voidtrimItem(com.sun.appserv.util.cache.BaseCache.CacheItem item) trim the item from the cache and notify listenersvoidtrimTimedoutItems(int maxTrimCount) trim the timedOut entries from the cache.voidtrimUnSortedTimedoutItems(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 victimsvalues()get an Iterator for the values stored in the cacheMethods inherited from class com.sun.ejb.containers.util.cache.LruEJBCache
itemAdded, setCacheName, trimLruMethods inherited from class com.sun.appserv.util.cache.LruCache
getStatByName, getStats, init, itemRefreshed, itemRemoved, setTimeout, trimExpiredEntriesMethods inherited from class com.sun.appserv.util.cache.BaseCache
_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, waitRefresh
-
Field Details
-
cacheIdleTimeoutInSeconds
protected int cacheIdleTimeoutInSeconds -
removalTimeoutInSeconds
protected int removalTimeoutInSeconds -
loadCountLock
-
loadFromBackupCount
protected int loadFromBackupCount -
removeIfIdle
protected boolean removeIfIdle -
container
-
backingStore
protected org.glassfish.ha.store.api.BackingStore<Serializable,org.glassfish.ha.store.util.SimpleMetadata> backingStore -
configData
-
confMaxCacheSize
protected int confMaxCacheSize
-
-
Constructor Details
-
LruSessionCache
public LruSessionCache(String cacheName, SFSBContainerCallback container, int cacheIdleTime, int removalTime)
-
-
Method Details
-
destroy
public void destroy()Destroys all references. This is the last method call of this object's life cycle. This method is called during undeploy of ejb container.- Specified by:
destroyin interfacecom.sun.appserv.util.cache.Cache- Overrides:
destroyin classcom.sun.appserv.util.cache.BaseCache
-
setBackingStore
public void setBackingStore(org.glassfish.ha.store.api.BackingStore<Serializable, org.glassfish.ha.store.util.SimpleMetadata> store) -
setStatefulSessionStoreMonitor
-
trimItem
protected void trimItem(com.sun.appserv.util.cache.BaseCache.CacheItem item) trim the item from the cache and notify listeners- Overrides:
trimItemin classcom.sun.appserv.util.cache.BaseCache- Parameters:
item- to be trimmed
-
itemAccessed
protected void itemAccessed(com.sun.appserv.util.cache.BaseCache.CacheItem item) - Overrides:
itemAccessedin classcom.sun.appserv.util.cache.LruCache
-
getLoadFromBackupCount
public int getLoadFromBackupCount() -
incrementLoadFromBackupCount
protected void incrementLoadFromBackupCount() -
lookupEJB
public StatefulEJBContext lookupEJB(Serializable sessionKey, SFSBContainerCallback container, Object cookie) -
remove
- Specified by:
removein interfacecom.sun.appserv.util.cache.Cache- Overrides:
removein classcom.sun.appserv.util.cache.BaseCache
-
remove
-
eligibleForRemovalFromCache
Called by StatefulSessionContainer before passivation to determine whether or not removal-timeout has elapsed for a cache item. If so, it will be directly removed instead of passivated. See issue 16188. -
passivateEJB
public boolean passivateEJB(StatefulEJBContext ctx, Serializable sessionKey) throws NotSerializableException - Throws:
NotSerializableException
-
setShutdownState
public void setShutdownState() -
setUndeployedState
public void setUndeployedState() -
values
get an Iterator for the values stored in the cache- Specified by:
valuesin interfacecom.sun.appserv.util.cache.Cache- Overrides:
valuesin classcom.sun.appserv.util.cache.BaseCache
-
shutdown
public void shutdown() -
trimTimedoutItems
public void trimTimedoutItems(int maxTrimCount) trim the timedOut entries from the cache. This call is to be scheduled by a thread managed by the container. In this case a sorted LRU list exists based on access time and this list is scanned -
trimUnSortedTimedoutItems
public 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 -
getNumVictimsAccessed
public int getNumVictimsAccessed() -
createItem
protected com.sun.appserv.util.cache.BaseCache.CacheItem createItem(int hashCode, Object sessionKey, Object value, int size) - Overrides:
createItemin classcom.sun.appserv.util.cache.LruCache
-
setConfigData
-
appendStats
- Specified by:
appendStatsin interfaceStatsProvider
-
getCacheHits
public int getCacheHits()- Specified by:
getCacheHitsin interfaceEjbCacheStatsProviderDelegate
-
getCacheMisses
public int getCacheMisses()- Specified by:
getCacheMissesin interfaceEjbCacheStatsProviderDelegate
-
getNumBeansInCache
public int getNumBeansInCache()- Specified by:
getNumBeansInCachein interfaceEjbCacheStatsProviderDelegate
-
getNumExpiredSessionsRemoved
public int getNumExpiredSessionsRemoved()- Specified by:
getNumExpiredSessionsRemovedin interfaceEjbCacheStatsProviderDelegate
-
getNumPassivationErrors
public int getNumPassivationErrors()- Specified by:
getNumPassivationErrorsin interfaceEjbCacheStatsProviderDelegate
-
getNumPassivations
public int getNumPassivations()- Specified by:
getNumPassivationsin interfaceEjbCacheStatsProviderDelegate
-
getNumPassivationSuccess
public int getNumPassivationSuccess()- Specified by:
getNumPassivationSuccessin interfaceEjbCacheStatsProviderDelegate
-
setMaxCacheSize
public void setMaxCacheSize(int val) -
getMaxCacheSize
public int getMaxCacheSize()- Specified by:
getMaxCacheSizein interfaceEjbCacheStatsProviderDelegate
-