org.jboss.ejb.plugins
Class LRUEnterpriseContextCachePolicy

java.lang.Object
  extended byorg.jboss.util.LRUCachePolicy (src) 
      extended byorg.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy
All Implemented Interfaces:
CachePolicy (src) , Monitorable (src) , XmlLoadable (src)
Direct Known Subclasses:
LRUStatefulContextCachePolicy (src)

public class LRUEnterpriseContextCachePolicy
extends LRUCachePolicy (src)
implements XmlLoadable (src) , Monitorable (src)

Least Recently Used cache policy for EnterpriseContexts.

See Also:
AbstractInstanceCache (src)

Nested Class Summary
protected  class LRUEnterpriseContextCachePolicy.ContextLRUList (src)
          Subclass that logs list activity events.
protected  class LRUEnterpriseContextCachePolicy.OveragerTask (src)
          This TimerTask passivates cached beans that have not been called for a while.
protected  class LRUEnterpriseContextCachePolicy.ResizerTask (src)
          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.
 
Nested classes inherited from class org.jboss.util.LRUCachePolicy (src)
LRUCachePolicy.LRUCacheEntry (src) , LRUCachePolicy.LRUList (src)
 
Field Summary
protected static Logger (src) log
           
protected static java.util.Timer tasksTimer
           
 
Fields inherited from class org.jboss.util.LRUCachePolicy (src)
m_list, m_map, m_maxCapacity, m_minCapacity
 
Constructor Summary
LRUEnterpriseContextCachePolicy(AbstractInstanceCache (src)  eic)
          Creates a LRU cache policy object given the instance cache that use this policy object.
 
Method Summary
protected  void ageOut(LRUCachePolicy.LRUCacheEntry (src)  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 (src) createList()
          Factory method for the linked list used by this cache implementation.
 void destroy()
          Destroys the cache that is now unusable.
 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 (src)
create, createCacheEntry, flush, get, insert, peek, remove, size
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static Logger (src)  log

tasksTimer

protected static java.util.Timer tasksTimer
Constructor Detail

LRUEnterpriseContextCachePolicy

public LRUEnterpriseContextCachePolicy(AbstractInstanceCache (src)  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 (src)
Samples the status of the implementor object and register the status into the snapshot argument.

Specified by:
sample in interface Monitorable (src)

start

public void start()
Description copied from class: LRUCachePolicy (src)
Starts this cache that is now ready to be used.

Specified by:
start in interface CachePolicy (src)
Overrides:
start in class LRUCachePolicy (src)
See Also:
LRUCachePolicy.create(), LRUCachePolicy.stop()

stop

public void stop()
Description copied from class: LRUCachePolicy (src)
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 CachePolicy (src)
Overrides:
stop in class LRUCachePolicy (src)
See Also:
LRUCachePolicy.start(), LRUCachePolicy.destroy()

destroy

public void destroy()
Description copied from class: LRUCachePolicy (src)
Destroys the cache that is now unusable.
To have it working again it must be re-LRUCachePolicy.create()ed and re-LRUCachePolicy.start()ed.

Specified by:
destroy in interface CachePolicy (src)
Overrides:
destroy in class LRUCachePolicy (src)
See Also:
LRUCachePolicy.create()

importXml

public void importXml(org.w3c.dom.Element element)
               throws DeploymentException (src) 
Reads from the configuration the parameters for this cache policy, that are all optionals. FIXME 20010626 marcf: Simone seriously arent' all the options overkill? give it another 6 month . Remember you are exposing the guts of this to the end user, also provide defaults so that if an entry is not specified you can still work and it looks _much_ better in the configuration files.

Specified by:
importXml in interface XmlLoadable (src)
Throws:
DeploymentException (src)

createList

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

Overrides:
createList in class LRUCachePolicy (src)

ageOut

protected void ageOut(LRUCachePolicy.LRUCacheEntry (src)  entry)
Description copied from class: LRUCachePolicy (src)
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 (src)

cacheMiss

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

Overrides:
cacheMiss in class LRUCachePolicy (src)