org.jboss.ejb.plugins
Class LRUEnterpriseContextCachePolicy

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

public class LRUEnterpriseContextCachePolicy
extends LRUCachePolicy
implements EnterpriseContextCachePolicy, XmlLoadable, Monitorable

Least Recently Used cache policy for EnterpriseContexts.

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

Inner Class Summary
protected  class LRUEnterpriseContextCachePolicy.ContextLRUList
          Subclass that send JMS messages on list activity events.
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
scheduler
 
Constructor Summary
LRUEnterpriseContextCachePolicy(AbstractInstanceCache 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.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 sample(java.lang.Object s)
          Samples the status of the implementor object and register the status into the snapshot argument.
 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
createCacheEntry, 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(AbstractInstanceCache eic)
Creates a LRU cache policy object given the instance cache that use this policy object.
Method Detail

sample

public void sample(java.lang.Object s)
Description copied from interface: Monitorable
Samples the status of the implementor object and register the status into the snapshot argument.
Specified by:
sample in interface Monitorable

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

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.