CoherenceTM v3.4
Copyright© 2000-2008 by Oracle Corporation

com.tangosol.net.cache
Class AbstractEvictionPolicy

java.lang.Object
  extended by com.tangosol.util.Base
      extended by com.tangosol.net.cache.AbstractEvictionPolicy
All Implemented Interfaces:
OldCache.EvictionPolicy, MapListener, java.io.Serializable, java.util.EventListener

public abstract class AbstractEvictionPolicy
extends Base
implements OldCache.EvictionPolicy, MapListener, java.io.Serializable

An abstract base class for custom cache eviction policies.

Author:
jh 2005.12.14

Constructor Summary
AbstractEvictionPolicy()
           
 
Method Summary
protected  LocalCache ensureLocalCache(MapEvent evt)
          Return the LocalCache that uses this eviction policy.
 void entryDeleted(MapEvent evt)
          Invoked when a map entry has been removed.
 void entryInserted(MapEvent evt)
          Invoked when a map entry has been inserted.
abstract  void entryTouched(OldCache.Entry entry)
          This method is called by the cache to indicate that an entry has been touched.
 void entryUpdated(MapEvent evt)
          Invoked when a map entry has been updated.
abstract  void entryUpdated(OldCache.Entry entry)
          This method is called to indicate that an entry has been either inserted or updated.
protected  OldCache.Entry getEntry(MapEvent evt)
          Return the map entry associated with the given map event.
protected  LocalCache getLocalCache()
          Return the LocalCache that uses this eviction policy.
abstract  void requestEviction(int cMaximum)
          This method is called by the cache when the cache requires the eviction policy to evict entries.
 

Constructor Detail

AbstractEvictionPolicy

public AbstractEvictionPolicy()
Method Detail

entryTouched

public abstract void entryTouched(OldCache.Entry entry)
This method is called by the cache to indicate that an entry has been touched.

Specified by:
entryTouched in interface OldCache.EvictionPolicy
Parameters:
entry - the Cache Entry that has been touched

entryUpdated

public abstract void entryUpdated(OldCache.Entry entry)
This method is called to indicate that an entry has been either inserted or updated.

Parameters:
entry - the Cache Entry that has been updated

requestEviction

public abstract void requestEviction(int cMaximum)
This method is called by the cache when the cache requires the eviction policy to evict entries.

Specified by:
requestEviction in interface OldCache.EvictionPolicy
Parameters:
cMaximum - the maximum number of units that should remain in the cache when the eviction is complete

entryInserted

public void entryInserted(MapEvent evt)
Invoked when a map entry has been inserted.

Specified by:
entryInserted in interface MapListener
Parameters:
evt - the MapEvent carrying the insert information

entryUpdated

public void entryUpdated(MapEvent evt)
Invoked when a map entry has been updated.

Specified by:
entryUpdated in interface MapListener
Parameters:
evt - the MapEvent carrying the update information

entryDeleted

public void entryDeleted(MapEvent evt)
Invoked when a map entry has been removed.

Specified by:
entryDeleted in interface MapListener
Parameters:
evt - the MapEvent carrying the delete information

ensureLocalCache

protected LocalCache ensureLocalCache(MapEvent evt)
Return the LocalCache that uses this eviction policy.

If the LocalCache property has not been intialized, it is set to the LocalCache that raised the given event.

Parameters:
evt - the MapEvent raised by the LocalCache that uses this eviction policy
Returns:
the LocalCache that uses this eviction policy

getEntry

protected OldCache.Entry getEntry(MapEvent evt)
Return the map entry associated with the given map event.

Parameters:
evt - a map event raised by the LocalCache that uses this eviction policy
Returns:
the map entry associated with the given event

getLocalCache

protected LocalCache getLocalCache()
Return the LocalCache that uses this eviction policy. The LocalCache is set the first time a map event is processed by the eviction policy.

Returns:
the LocalCache or null if a map event has not yet been processed by this eviction policy
See Also:
ensureLocalCache

CoherenceTM v3.4
Copyright© 2000-2008 by Oracle Corporation