Class FIFOEJBObjectCache

    • Field Detail

      • maxCacheSize

        protected int maxCacheSize
      • refCountLock

        protected Object refCountLock
      • totalRefCount

        protected int totalRefCount
      • _printRefCount

        protected static final boolean _printRefCount
    • Constructor Detail

      • FIFOEJBObjectCache

        public FIFOEJBObjectCache​(String name)
        default constructor
      • FIFOEJBObjectCache

        public FIFOEJBObjectCache​(String name,
                                  long timeout)
        constructor with specified timeout
    • Method Detail

      • init

        public void init​(int maxEntries,
                         int numberOfVictimsToSelect,
                         long timeout,
                         float loadFactor,
                         Properties props)
        Specified by:
        init in interface EJBObjectCache
      • get

        public Object get​(Object key)
        Description copied from class: BaseCache
        get the item stored at the key.
        Specified by:
        get in interface Cache
        Overrides:
        get in class BaseCache
        Parameters:
        key - lookup key
      • put

        public Object put​(Object key,
                          Object value)
        Description copied from class: BaseCache
        /** cache the given value at the specified key and return previous value
        Specified by:
        put in interface Cache
        Overrides:
        put in class BaseCache
        Parameters:
        key - lookup key
      • isThresholdReached

        protected boolean isThresholdReached()
        Description copied from class: BaseCache
        has cache reached its threshold
        Overrides:
        isThresholdReached in class BaseCache
        Returns:
        true when the cache reached its threshold
      • 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
      • itemRemoved

        protected void itemRemoved​(BaseCache.CacheItem item)
        Description copied from class: LruCache
        item value has been removed from the cache
        Overrides:
        itemRemoved in class LruCache
        Parameters:
        item - CacheItem that was just removed Cache bucket is already synchronized by the caller
      • internalGet

        protected Object internalGet​(int hashCode,
                                     Object key,
                                     boolean incrementRefCount)
      • internalPut

        protected Object internalPut​(int hashCode,
                                     Object key,
                                     Object value,
                                     int size,
                                     boolean incrementRefCount)
      • print

        public void print()
      • internalRemove

        protected Object internalRemove​(Object key,
                                        boolean decrementRefCount)
      • createItem

        protected BaseCache.CacheItem createItem​(int hashCode,
                                                 Object key,
                                                 Object value,
                                                 int size)
        Description copied from class: LruCache
        create new item
        Overrides:
        createItem in class LruCache
        Parameters:
        hashCode - for the entry
        key - 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.
      • getStats

        public Map getStats()
        Description copied from class: BaseCache
        get the stats snapshot
        Specified by:
        getStats in interface Cache
        Overrides:
        getStats in class LruCache
        Returns:
        a Map of stats See also: Constant.java for the keys
      • trimExpiredEntries

        public void trimExpiredEntries​(int maxCount)
        Description copied from class: LruCache
        trim the expired entries from the cache.
        Specified by:
        trimExpiredEntries in interface Cache
        Overrides:
        trimExpiredEntries in class LruCache
        Parameters:
        maxCount - 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).
      • incrementReferenceCount

        protected void incrementReferenceCount()
      • decrementReferenceCount

        protected void decrementReferenceCount()
      • decrementReferenceCount

        protected void decrementReferenceCount​(int count)