Class BeaconCacheEvictor
- java.lang.Object
-
- com.dynatrace.openkit.core.caching.BeaconCacheEvictor
-
public class BeaconCacheEvictor extends java.lang.ObjectClass responsible for handling an eviction thread, to ensure BeaconCache stays in configured boundaries.
-
-
Constructor Summary
Constructors Constructor Description BeaconCacheEvictor(Logger logger, BeaconCache beaconCache, BeaconCacheConfiguration configuration, TimingProvider timingProvider)Public constructor, initializing the eviction thread with the defaultTimeEvictionStrategyandSpaceEvictionStrategystrategies.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanisAlive()booleanstart()Starts the eviction thread.booleanstop()Stops the eviction thread and joins withEVICTION_THREAD_JOIN_TIMEOUT.booleanstop(long timeout)Stops the eviction thread viaThread.interrupt(), if it's alive and joins the eviction thread with giventimeout.
-
-
-
Constructor Detail
-
BeaconCacheEvictor
public BeaconCacheEvictor(Logger logger, BeaconCache beaconCache, BeaconCacheConfiguration configuration, TimingProvider timingProvider)
Public constructor, initializing the eviction thread with the defaultTimeEvictionStrategyandSpaceEvictionStrategystrategies.- Parameters:
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 retrieval
-
-
Method Detail
-
start
public boolean start()
Starts the eviction thread.- Returns:
trueif the eviction thread was started,falseif the thread was already running.
-
stop
public boolean stop()
Stops the eviction thread and joins withEVICTION_THREAD_JOIN_TIMEOUT.See also
stop(long).
-
stop
public boolean stop(long timeout)
Stops the eviction thread viaThread.interrupt(), if it's alive and joins the eviction thread with giventimeout.- Parameters:
timeout- The number of milliseconds to join the thread.- Returns:
trueif stopping was successful,falseif eviction thread is not running or could not be stopped in time.
-
isAlive
public boolean isAlive()
-
-