public class TwoGenerationCache<K,V> extends LRUCache<K,V>
TwoGenerationCache
keeps track of how
often an object has been
asked for. If the number of GETs increases beyond a certain limit, then the
object in question will be removed from this cache and added to the older
generation. A request for an object will always ask the older generation
before itself.GenericService.StartCommand, GenericService.StopCommand
CLASS_VERSION
mLogger, state
Constructor and Description |
---|
TwoGenerationCache() |
Modifier and Type | Method and Description |
---|---|
Cache |
getOldGeneration() |
int |
getPromoteThreshold() |
void |
setOldGeneration(SimpleCache<K,V> pCache) |
void |
setPromoteThreshold(int pThreshold) |
protected void |
startService()
Is called by
AbstractNurseryService.doStartService() when the NurseryService is being started. |
getCacheItems, getKeys, getSize, stopService
addObject, expireObject, flushCache, getAdds, getAges, getAverageIdleTimeSinceLastThrow, getAverageIdleTimeWhenThrown, getCacheStatistics, getCacheType, getClears, getExpires, getHitRatio, getHits, getLastThrow, getMaxSize, getMisses, getObject, getPushes, getRemoves, getReport, getStatistic, getStatisticKeys, getTimeSinceLastThrow, getTotalTime, getValidSeconds, hasObject, remove, reset, setCacheType, setMaxSize, setValidSeconds, toString
doStartService, doStopService, stopIdleService
assertServiceRunning, getServiceDescription, getServiceMessage, getServiceState, isServiceEnabled, isServiceFailed, isServiceIdle, isServiceRunning, isServiceShutdownFailed, isServiceStopped, setServiceDescription, setServiceEnabled, start, stop, validateIsTrue, validateNotNull
public TwoGenerationCache() throws RemoteException
RemoteException
public void setPromoteThreshold(int pThreshold)
public int getPromoteThreshold()
public void setOldGeneration(SimpleCache<K,V> pCache)
protected void startService() throws Exception
AbstractNurseryService
Is called by AbstractNurseryService.doStartService()
when the NurseryService
is being started. Exceptions thrown by this
method are logged by AbstractNurseryService.doStartService()
.
Subclasses must implement this method to bootstrap the service.
startService
in class LRUCache<K,V>
Exception
- when something goes wrong during startup. GenericService.isServiceRunning()
will return false
and GenericService.isServiceFailed()
will return true
.IllegalArgumentException
- when the configuration of the service
is invalid. GenericService.isServiceRunning()
will return false
and GenericService.isServiceFailed()
will return true
.IllegalStateException
- when this service is in the wrong state for startup. Used to signal to AbstractNurseryService.doStartService()
that it is OK to try to starting
this service
later. GenericService.isServiceRunning()
returns false
and GenericService.isServiceIdle()
returns true
.AbstractNurseryService.doStartService()
public Cache getOldGeneration()
© 1998- 2018 Stibo DX