## org.jboss.ejb.plugins
Class LRUEnterpriseContextCachePolicy

    java.lang.Object
      |
      +--org.jboss.util.LRUCachePolicy
            |
            +--org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy

All Implemented Interfaces:
  CachePolicy, Monitorable, Service, XmlLoadable

Direct Known Subclasses:
  LRUStatefulContextCachePolicy

public class LRUEnterpriseContextCachePolicy
extends LRUCachePolicy
implements XmlLoadable, Monitorable

Least Recently Used cache policy for EnterpriseContexts.

Version:
  $Revision: 1.7.4.8 $
Author:
  Simone Bordet
See Also:
  `AbstractInstanceCache`

Inner Class Summary
`protected class` `LRUEnterpriseContextCachePolicy.ContextLRUList` Subclass that logs 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`

Field Summary
`protected static Logger` `log`
`protected static java.util.Timer` `tasksTimer`

Fields inherited from class org.jboss.util.LRUCachePolicy
`m_list, m_map, m_maxCapacity, m_minCapacity`

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` `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
`createCacheEntry, flush, get, init, insert, peek, remove`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### log

    protected static Logger log

### tasksTimer

    protected static java.util.Timer tasksTimer

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.
  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.
  Overrides:
    `stop` in class `LRUCachePolicy`
  Following copied from class: `org.jboss.util.LRUCachePolicy`
  See Also:
    `LRUCachePolicy.start()`, `LRUCachePolicy.destroy()`

### destroy

    public void destroy()

  Description copied from class: `LRUCachePolicy`
  Destroys the cache that is now unusable.
  To have it working again it must be re-`LRUCachePolicy.init()`ialized and re-`LRUCachePolicy.start()`ed.
  Overrides:
    `destroy` in class `LRUCachePolicy`
  Following copied from class: `org.jboss.util.LRUCachePolicy`
  See Also:
    `LRUCachePolicy.init()`

### 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. 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`

### 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.