org.castor.cache.hashbelt.reaper
Class RefreshingReaper<K,V>
java.lang.Object
org.castor.cache.hashbelt.reaper.AbstractReaper<K,V>
org.castor.cache.hashbelt.reaper.RefreshingReaper<K,V>
- Type Parameters:
K - the type of keys maintained by this cacheV - the type of cached values
- All Implemented Interfaces:
- Reaper<K,V>
public abstract class RefreshingReaper<K,V>
- extends AbstractReaper<K,V>
Calls a refresh method on each object in the container; it reinserts any
returned object to the front of the expiration system. Useful for any object
that needs to be periodically refreshed from source; you are free to return
the same object that was called or to replace it with a refreshed version of
that object.
Note that you must supply the implementation of the refresh method.
- Since:
- 1.0
- Version:
- $Revision: 9040 $ $Date: 2011-08-16 08:26:59 +0200 (Di, 16 Aug 2011) $
- Author:
- Gregory Block
|
Method Summary |
void |
handleExpiredContainer(Container<K,V> expiredContainer)
Methode called with a container that has expired before the container is garbage
collected. |
protected abstract V |
refresh(V objectToBeRefreshed)
Function called to attempt to refresh the object. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RefreshingReaper
public RefreshingReaper()
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.
refresh
protected abstract V refresh(V objectToBeRefreshed)
- Function called to attempt to refresh the object. If refresh was successful,
return the refreshed object; if not, return null.
- Parameters:
objectToBeRefreshed - The object to be refreshed.
- Returns:
- The refreshed object, or null if the object could not be refreshed.
Copyright © 2012. All Rights Reserved.