org.castor.cache.hashbelt.reaper
Class ReinsertingReaper<K,V>

java.lang.Object
  extended by org.castor.cache.hashbelt.reaper.AbstractReaper<K,V>
      extended by org.castor.cache.hashbelt.reaper.ReinsertingReaper<K,V>
Type Parameters:
K - the type of keys maintained by this cache
V - the type of cached values
All Implemented Interfaces:
Reaper<K,V>

public abstract class ReinsertingReaper<K,V>
extends AbstractReaper<K,V>

A hybrid of the notifying and refreshing reaper; like the notifying reaper, this calls handleExpiredObject for the object; like the refreshing reaper, it then reinserts it in the front of the expiration system. Unlike the refreshing reaper, it always returns the exact same object to the front of the expiration system.

Useful for alerts and announcements. E.g. suppose you're supposed to send someone an update every 15 minutes. Use this one and an object that sends the message inside its "expire" method.

Since:
1.0
Version:
$Revision: 9040 $ $Date: 2011-08-16 08:26:59 +0200 (Di, 16 Aug 2011) $
Author:
Gregory Block

Constructor Summary
ReinsertingReaper()
           
 
Method Summary
 void handleExpiredContainer(Container<K,V> expiredContainer)
          Methode called with a container that has expired before the container is garbage collected.
protected abstract  void handleExpiredObject(V expiredObject)
          Methode called with an object that has expired before it is garbage collected.
 
Methods inherited from class org.castor.cache.hashbelt.reaper.AbstractReaper
getCache, setCache
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReinsertingReaper

public ReinsertingReaper()
Method Detail

handleExpiredContainer

public final void handleExpiredContainer(Container<K,V> expiredContainer)
Methode called with a container that has expired before the container is garbage collected.

Parameters:
expiredContainer - The container that has expired.

handleExpiredObject

protected abstract void handleExpiredObject(V expiredObject)
Methode called with an object that has expired before it is garbage collected.

Parameters:
expiredObject - The object that has expired.


Copyright © 2012. All Rights Reserved.