public class BeaconCacheEvictor
extends java.lang.Object
| Constructor and Description |
|---|
BeaconCacheEvictor(Logger logger,
BeaconCache beaconCache,
BeaconCacheConfiguration configuration,
TimingProvider timingProvider)
Public constructor, initializing the eviction thread with the default
TimeEvictionStrategy and SpaceEvictionStrategy strategies. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
isAlive() |
boolean |
start()
Starts the eviction thread.
|
boolean |
stop()
Stops the eviction thread and joins with
EVICTION_THREAD_JOIN_TIMEOUT. |
boolean |
stop(long timeout)
Stops the eviction thread via
Thread.interrupt(), if it's alive and joins the eviction thread with given timeout. |
public BeaconCacheEvictor(Logger logger, BeaconCache beaconCache, BeaconCacheConfiguration configuration, TimingProvider timingProvider)
TimeEvictionStrategy and SpaceEvictionStrategy strategies.logger - Logger to write some debug outputbeaconCache - The Beacon cache to check if entries need to be evictedconfiguration - Beacon cache configurationtimingProvider - Timing provider required for time retrievalpublic boolean start()
true if the eviction thread was started, false if the thread was already running.public boolean stop()
EVICTION_THREAD_JOIN_TIMEOUT.
See also stop(long).
public boolean stop(long timeout)
Thread.interrupt(), if it's alive and joins the eviction thread with given timeout.timeout - The number of milliseconds to join the thread.true if stopping was successful, false if eviction thread is not running
or could not be stopped in time.public boolean isAlive()