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

public class LruSessionCache extends LruEJBCache implements EjbCacheStatsProviderDelegate
  • Field Details

    • cacheIdleTimeoutInSeconds

      protected int cacheIdleTimeoutInSeconds
    • removalTimeoutInSeconds

      protected int removalTimeoutInSeconds
    • loadCountLock

      protected Object loadCountLock
    • loadFromBackupCount

      protected int loadFromBackupCount
    • removeIfIdle

      protected boolean removeIfIdle
    • container

      protected SFSBContainerCallback container
    • backingStore

      protected org.glassfish.ha.store.api.BackingStore<Serializable,org.glassfish.ha.store.util.SimpleMetadata> backingStore
    • configData

      protected String configData
    • confMaxCacheSize

      protected int confMaxCacheSize
  • Constructor Details

  • 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:
      destroy in interface com.sun.appserv.util.cache.Cache
      Overrides:
      destroy in class com.sun.appserv.util.cache.BaseCache
    • setBackingStore

      public void setBackingStore(org.glassfish.ha.store.api.BackingStore<Serializable,org.glassfish.ha.store.util.SimpleMetadata> store)
    • setStatefulSessionStoreMonitor

      public void setStatefulSessionStoreMonitor(StatefulSessionStoreMonitor storeMonitor)
    • trimItem

      protected void trimItem(com.sun.appserv.util.cache.BaseCache.CacheItem item)
      trim the item from the cache and notify listeners
      Overrides:
      trimItem in class com.sun.appserv.util.cache.BaseCache
      Parameters:
      item - to be trimmed
    • itemAccessed

      protected void itemAccessed(com.sun.appserv.util.cache.BaseCache.CacheItem item)
      Overrides:
      itemAccessed in class com.sun.appserv.util.cache.LruCache
    • getLoadFromBackupCount

      public int getLoadFromBackupCount()
    • incrementLoadFromBackupCount

      protected void incrementLoadFromBackupCount()
    • lookupEJB

      public StatefulEJBContext lookupEJB(Serializable sessionKey, SFSBContainerCallback container, Object cookie)
    • remove

      public Object remove(Object sessionKey)
      Specified by:
      remove in interface com.sun.appserv.util.cache.Cache
      Overrides:
      remove in class com.sun.appserv.util.cache.BaseCache
    • remove

      public Object remove(Object sessionKey, boolean removeFromStore)
    • eligibleForRemovalFromCache

      public boolean eligibleForRemovalFromCache(StatefulEJBContext ctx, Serializable sessionKey)
      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

      public Iterator values()
      get an Iterator for the values stored in the cache
      Specified by:
      values in interface com.sun.appserv.util.cache.Cache
      Overrides:
      values in class com.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:
      createItem in class com.sun.appserv.util.cache.LruCache
    • setConfigData

      public void setConfigData(String configData)
    • appendStats

      public void appendStats(StringBuffer sbuf)
      Specified by:
      appendStats in interface StatsProvider
    • getCacheHits

      public int getCacheHits()
      Specified by:
      getCacheHits in interface EjbCacheStatsProviderDelegate
    • getCacheMisses

      public int getCacheMisses()
      Specified by:
      getCacheMisses in interface EjbCacheStatsProviderDelegate
    • getNumBeansInCache

      public int getNumBeansInCache()
      Specified by:
      getNumBeansInCache in interface EjbCacheStatsProviderDelegate
    • getNumExpiredSessionsRemoved

      public int getNumExpiredSessionsRemoved()
      Specified by:
      getNumExpiredSessionsRemoved in interface EjbCacheStatsProviderDelegate
    • getNumPassivationErrors

      public int getNumPassivationErrors()
      Specified by:
      getNumPassivationErrors in interface EjbCacheStatsProviderDelegate
    • getNumPassivations

      public int getNumPassivations()
      Specified by:
      getNumPassivations in interface EjbCacheStatsProviderDelegate
    • getNumPassivationSuccess

      public int getNumPassivationSuccess()
      Specified by:
      getNumPassivationSuccess in interface EjbCacheStatsProviderDelegate
    • setMaxCacheSize

      public void setMaxCacheSize(int val)
    • getMaxCacheSize

      public int getMaxCacheSize()
      Specified by:
      getMaxCacheSize in interface EjbCacheStatsProviderDelegate