Class BeaconCacheEvictor


  • public class BeaconCacheEvictor
    extends java.lang.Object
    Class responsible for handling an eviction thread, to ensure BeaconCache stays in configured boundaries.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • BeaconCacheEvictor

        public BeaconCacheEvictor​(Logger logger,
                                  BeaconCache beaconCache,
                                  BeaconCacheConfiguration configuration,
                                  TimingProvider timingProvider)
        Public constructor, initializing the eviction thread with the default TimeEvictionStrategy and SpaceEvictionStrategy strategies.
        Parameters:
        logger - Logger to write some debug output
        beaconCache - The Beacon cache to check if entries need to be evicted
        configuration - Beacon cache configuration
        timingProvider - Timing provider required for time retrieval
    • Method Detail

      • start

        public boolean start()
        Starts the eviction thread.
        Returns:
        true if the eviction thread was started, false if the thread was already running.
      • stop

        public boolean stop​(long timeout)
        Stops the eviction thread via Thread.interrupt(), if it's alive and joins the eviction thread with given timeout.
        Parameters:
        timeout - The number of milliseconds to join the thread.
        Returns:
        true if stopping was successful, false if eviction thread is not running or could not be stopped in time.
      • isAlive

        public boolean isAlive()