org.jboss.ejb.plugins
Class LRUEnterpriseContextCachePolicy

java.lang.Object
  |
  +--org.jboss.util.LRUCachePolicy
        |
        +--org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy
All Implemented Interfaces:
CachePolicy, EnterpriseContextCachePolicy, Service, XmlLoadable

public class LRUEnterpriseContextCachePolicy
extends LRUCachePolicy
implements EnterpriseContextCachePolicy, XmlLoadable

Least Recently Used cache policy for EnterpriseContexts.

Version:
$Revision: 1.2 $
Author:
Simone Bordet (simone.bordet@compaq.com)
See Also:
EnterpriseInstanceCache

Inner Class Summary
protected  class LRUEnterpriseContextCachePolicy.ContextLRUEntry
           
protected  class LRUEnterpriseContextCachePolicy.ContextLRUList
           
protected  class LRUEnterpriseContextCachePolicy.OveragerTask
          This TimerTask passivates cached beans that have not been called for a while.
protected  class LRUEnterpriseContextCachePolicy.ResizerTask
          This TimerTask resizes the cache capacity using the cache miss frequency algorithm, that is the more cache misses we have, the more the cache size is enlarged, and viceversa.
 
Inner classes inherited from class org.jboss.util.LRUCachePolicy
LRUCachePolicy.LRUCacheEntry, LRUCachePolicy.LRUList
 
Inner classes inherited from class org.jboss.ejb.plugins.EnterpriseContextCachePolicy
EnterpriseContextCachePolicy.Scheduler
 
Fields inherited from class org.jboss.util.LRUCachePolicy
m_list, m_map, m_maxCapacity, m_minCapacity
 
Fields inherited from interface org.jboss.ejb.plugins.EnterpriseContextCachePolicy
log, scheduler
 
Constructor Summary
LRUEnterpriseContextCachePolicy(EnterpriseInstanceCache eic)
          Creates a LRU cache policy object given the instance cache that use this policy object.
 
Method Summary
protected  void ageOut(LRUCachePolicy.LRUCacheEntry entry)
          Callback method called when the cache algorithm ages out of the cache the given entry.
protected  void cacheMiss()
          Callback method called when a cache miss happens.
protected  LRUCachePolicy.LRUCacheEntry createCacheEntry(java.lang.Object key, java.lang.Object value)
          Factory method for cache entries
protected  LRUCachePolicy.LRUList createList()
          Factory method for the linked list used by this cache implementation.
 void importXml(org.w3c.dom.Element element)
          Reads from the configuration the parameters for this cache policy, that are all optionals.
 void start()
          Starts this cache that is now ready to be used.
 void stop()
          Stops this cache thus LRUCachePolicy.flush()ing all cached objects.
 
Methods inherited from class org.jboss.util.LRUCachePolicy
destroy, flush, get, init, insert, peek, remove
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jboss.util.CachePolicy
flush, get, insert, peek, remove
 
Methods inherited from interface org.jboss.util.Service
destroy, init
 

Constructor Detail

LRUEnterpriseContextCachePolicy

public LRUEnterpriseContextCachePolicy(EnterpriseInstanceCache eic)
Creates a LRU cache policy object given the instance cache that use this policy object.
Method Detail

start

public void start()
           throws java.lang.Exception
Description copied from class: LRUCachePolicy
Starts this cache that is now ready to be used.
Specified by:
start in interface Service
Overrides:
start in class LRUCachePolicy
Following copied from class: org.jboss.util.LRUCachePolicy
See Also:
LRUCachePolicy.init(), LRUCachePolicy.stop()

stop

public void stop()
Description copied from class: LRUCachePolicy
Stops this cache thus LRUCachePolicy.flush()ing all cached objects.
After this method is called, a call to LRUCachePolicy.start() will restart the cache.
Specified by:
stop in interface Service
Overrides:
stop in class LRUCachePolicy
Following copied from class: org.jboss.util.LRUCachePolicy
See Also:
LRUCachePolicy.start(), LRUCachePolicy.destroy()

importXml

public void importXml(org.w3c.dom.Element element)
               throws DeploymentException
Reads from the configuration the parameters for this cache policy, that are all optionals.
Specified by:
importXml in interface XmlLoadable

createList

protected LRUCachePolicy.LRUList createList()
Description copied from class: LRUCachePolicy
Factory method for the linked list used by this cache implementation.
Overrides:
createList in class LRUCachePolicy

createCacheEntry

protected LRUCachePolicy.LRUCacheEntry createCacheEntry(java.lang.Object key,
                                                        java.lang.Object value)
Description copied from class: LRUCachePolicy
Factory method for cache entries
Overrides:
createCacheEntry in class LRUCachePolicy

ageOut

protected void ageOut(LRUCachePolicy.LRUCacheEntry entry)
Description copied from class: LRUCachePolicy
Callback method called when the cache algorithm ages out of the cache the given entry.
The implementation here is removing the given entry from the cache.
Overrides:
ageOut in class LRUCachePolicy

cacheMiss

protected void cacheMiss()
Description copied from class: LRUCachePolicy
Callback method called when a cache miss happens.
Overrides:
cacheMiss in class LRUCachePolicy


Copyright © 2000 The jBoss Organization. All Rights Reserved.