org.terracotta.cache.evictor
Class OrphanEvictionListener<K>

java.lang.Object
  extended by org.terracotta.cache.evictor.OrphanEvictionListener<K>
All Implemented Interfaces:
EvictionListener

public class OrphanEvictionListener<K>
extends Object
implements EvictionListener

At the beginning of each run, the cache attempts to become the "orphan evictor". For each chunk of the cache, only one of the local evictors in the cluster will become the orphan evictor. That thread is responsible for both its own local eviction and also the orphan eviction. Orphan eviction entails checking "orphan" keys (those not currently faulted into any node's cache) for eviction. The process of doing this will cause those keys to be loaded into this node such that they are no longer orphans.


Constructor Summary
OrphanEvictionListener(CacheConfig config, Evictable<K> store, EvictorLock orphanEvictorLock)
          Construct an orphan eviction listener with clustered state
 
Method Summary
 void endLocalEviction()
          Perform orphan eviction
 void onShutdown()
          On shutdown, release the orphan evictor lock so it can be reobtained by a later evictor.
 void startLocalEviction()
          Attempt to obtain orphan evictor write lock.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OrphanEvictionListener

public OrphanEvictionListener(CacheConfig config,
                              Evictable<K> store,
                              EvictorLock orphanEvictorLock)
Construct an orphan eviction listener with clustered state

Parameters:
config - The clustered configuration of the orphan distributed map and orphan evictor
store - The clustered store to evict
orphanEvictorLock - The clustered lock that is used as a token to indicate the elected orphan evictor
Method Detail

startLocalEviction

public void startLocalEviction()
Attempt to obtain orphan evictor write lock. If successful, set isOrphanEvictor to true

Specified by:
startLocalEviction in interface EvictionListener

endLocalEviction

public void endLocalEviction()
Perform orphan eviction

Specified by:
endLocalEviction in interface EvictionListener

onShutdown

public void onShutdown()
On shutdown, release the orphan evictor lock so it can be reobtained by a later evictor.

Specified by:
onShutdown in interface EvictionListener


Copyright © 2010 Terracotta, Inc.. All Rights Reserved.