Class LruSessionCache

    • Field Detail

      • cacheIdleTimeoutInSeconds

        protected int cacheIdleTimeoutInSeconds
      • removalTimeoutInSeconds

        protected int removalTimeoutInSeconds
      • loadCountLock

        protected Object loadCountLock
      • loadFromBackupCount

        protected int loadFromBackupCount
      • removeIfIdle

        protected boolean removeIfIdle
      • 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 Detail

      • LruSessionCache

        public LruSessionCache​(String cacheName,
                               SFSBContainerCallback container,
                               int cacheIdleTime,
                               int removalTime)
    • Method Detail

      • 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 Cache
        Overrides:
        destroy in class BaseCache
      • setBackingStore

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

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

        protected void itemAccessed​(BaseCache.CacheItem item)
        Description copied from class: LruCache
        this item is accessed
        Overrides:
        itemAccessed in class LruCache
        Parameters:
        item - CacheItem accessed Cache bucket is already synchronized by the caller
      • getLoadFromBackupCount

        public int getLoadFromBackupCount()
      • incrementLoadFromBackupCount

        protected void incrementLoadFromBackupCount()
      • remove

        public Object remove​(Object sessionKey)
        Description copied from class: BaseCache
        remove the item stored at the key.
        Specified by:
        remove in interface Cache
        Overrides:
        remove in class BaseCache
        Parameters:
        sessionKey - lookup key
      • 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.
      • setShutdownState

        public void setShutdownState()
      • setUndeployedState

        public void setUndeployedState()
      • 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 BaseCache.CacheItem createItem​(int hashCode,
                                                 Object sessionKey,
                                                 Object value,
                                                 int size)
        Description copied from class: LruCache
        create new item
        Overrides:
        createItem in class LruCache
        Parameters:
        hashCode - for the entry
        sessionKey - Object key
        value - Object value
        size - size in bytes of the item subclasses may override to provide their own CacheItem extensions e.g. one that permits persistence.
      • setConfigData

        public void setConfigData​(String configData)
      • setMaxCacheSize

        public void setMaxCacheSize​(int val)