Class FIFOEJBObjectCache

  • All Implemented Interfaces:
    com.sun.appserv.util.cache.Cache, EJBObjectCache

    public class FIFOEJBObjectCache
    extends com.sun.ejb.containers.util.cache.LruEJBCache
    implements EJBObjectCache
    A FIFO EJB(Local)Object cache that maintains reference count
    Author:
    Mahesh Kannan
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      protected static class  FIFOEJBObjectCache.EJBObjectCacheItem  
      • Nested classes/interfaces inherited from class com.sun.appserv.util.cache.LruCache

        com.sun.appserv.util.cache.LruCache.LruCacheItem
      • Nested classes/interfaces inherited from class com.sun.appserv.util.cache.BaseCache

        com.sun.appserv.util.cache.BaseCache.CacheItem
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static boolean _printRefCount  
      protected EJBObjectCacheListener listener  
      protected int maxCacheSize  
      protected String name  
      protected Object refCountLock  
      protected int totalRefCount  
      • Fields inherited from class com.sun.ejb.containers.util.cache.LruEJBCache

        cacheName
      • Fields inherited from class com.sun.appserv.util.cache.LruCache

        defaultMaxEntries, head, isUnbounded, listSize, NO_TIMEOUT, tail, timeout, trimCount
      • Fields inherited from class com.sun.appserv.util.cache.BaseCache

        bucketLocks, buckets, entryCount, hitCount, listeners, maxBuckets, maxEntries, missCount, refreshFlags, removalCount, threshold
    • 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)
        Specified by:
        get in interface com.sun.appserv.util.cache.Cache
        Overrides:
        get in class com.sun.appserv.util.cache.BaseCache
      • put

        public Object put​(Object key,
                          Object value)
        Specified by:
        put in interface com.sun.appserv.util.cache.Cache
        Overrides:
        put in class com.sun.appserv.util.cache.BaseCache
      • remove

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

        protected boolean isThresholdReached()
        Overrides:
        isThresholdReached in class com.sun.appserv.util.cache.BaseCache
      • itemAccessed

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

        protected void itemRemoved​(com.sun.appserv.util.cache.BaseCache.CacheItem item)
        Overrides:
        itemRemoved in class com.sun.appserv.util.cache.LruCache
      • 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 com.sun.appserv.util.cache.BaseCache.CacheItem createItem​(int hashCode,
                                                                            Object key,
                                                                            Object value,
                                                                            int size)
        Overrides:
        createItem in class com.sun.appserv.util.cache.LruCache
      • getStats

        public Map getStats()
        Specified by:
        getStats in interface com.sun.appserv.util.cache.Cache
        Overrides:
        getStats in class com.sun.appserv.util.cache.LruCache
      • trimExpiredEntries

        public void trimExpiredEntries​(int maxCount)
        Specified by:
        trimExpiredEntries in interface com.sun.appserv.util.cache.Cache
        Overrides:
        trimExpiredEntries in class com.sun.appserv.util.cache.LruCache
      • incrementReferenceCount

        protected void incrementReferenceCount()
      • decrementReferenceCount

        protected void decrementReferenceCount()
      • decrementReferenceCount

        protected void decrementReferenceCount​(int count)