IBM WebSphereTM eXtreme Scale, Release 8.6
API Specification

com.ibm.websphere.objectgrid.plugins
Interface Evictor

All Known Implementing Classes:
LFUEvictor, LRUEvictor

public interface Evictor

Data contained in a BackingMap are evicted when the map is full. This plugin is used by the BackingMap to determine when and what to evict from the map based on some algorithm (LRU, LFU, time based, etc).

An Evictor implementation that also implements the BackingMapLifecycleListener interface will be automatically added as an EventListener on the BackingMap when the evictor set on the backing map.

An Evictor may also implement the BackingMapPlugin interface in order to receive enhanced BackingMap plug-in lifecycle method calls. The plug-in is then also required to correctly implement each of the bean methods related to introspection of its state (for example isInitialized(), isDestroyed(), etc).

Since:
WAS XD 6.0, XC10
See Also:
BackingMap.addMapEventListener(EventListener), BackingMap.setEvictor(Evictor), EvictorData

Method Summary
 void activate()
          This method is called to activate the Evictor.
 void apply(LogSequence sequence)
          Called after a transaction has committed to allow the evictor to track object usage in the BackingMap.
 void deactivate()
          This method is called to deactivate the Evictor.
 void destroy()
          Called when the BackingMap associated with this evictor is destroyed.
 void initialize(BackingMap map, EvictionEventCallback callback)
          Called by a BackingMap instance during the evictor initialization time.
 

Method Detail

initialize

void initialize(BackingMap map,
                EvictionEventCallback callback)

Called by a BackingMap instance during the evictor initialization time.

The BackingMap calls this method so the Evictor instance can have references to the BackingMap and EvictionEventCallback instances. The evictor can signal events to have specific entries evicted using the EvictionEventCallback.

Parameters:
map - the BackingMap instance
callback - the EvictionEventCallback instance
See Also:
BackingMap, EvictionEventCallback

destroy

void destroy()

Called when the BackingMap associated with this evictor is destroyed.

This method is the opposite of the initialize method. When it is called, the Evictor can free up any resources it uses.

See Also:
ObjectGrid.destroy()

apply

void apply(LogSequence sequence)
Called after a transaction has committed to allow the evictor to track object usage in the BackingMap.

This method also reports any entries that have been successfully evicted. Note, this method is not called for transactions that are rolled back. If there is a need to track object usage for rolled back transactions, the evictor must implement the RollbackEvictor interface as well.

This method is called after a transaction has completed. Consequently, all transaction locks that were acquired by the completed transaction are no longer held. Potentially, multiple threads could call this method concurrently and each thread would be completing its own transaction. Since transaction locks are already released by the completed transaction, this method must provide its own synchronization to ensure it is thread safe. For an Evictor in an ObjectMap that is configured to use OutputFormat.RAW for the keys or values, the keys and values objects in the LogSequence will be SerializedKey or SerializedValue objects respectively. If required, you can use the SerializedEntry.getObject() method to retrieve (possibly inflating the serialized object) the original key or value object. To override the map's output format configuration, use the PluginOutputFormat annotation in the implementation class.

Parameters:
sequence - the LogSequence of changes committed to the map
See Also:
RollbackEvictor

activate

void activate()
This method is called to activate the Evictor. Until this method is called, the Evictor must not use the EvictionEventCallback interface to evict any map entries. If it does use the EvictionEventcallback interface to evict map entries prior to activate being called, an IllegalStateException is thrown.


deactivate

void deactivate()
This method is called to deactivate the Evictor. Once this method is called, the Evictor must quit using the EvictionEventCallback interface to evict any map entries. If it does use the EvictionEventcallback interface after this method is called, an IllegalStateException is thrown.


IBM WebSphereTM eXtreme Scale, Release 8.6
API Specification

© Copyright International Business Machines Corp 2005,2012. All rights reserved.