public EvictionStatistics() { if (CacheConfigFactory.DSO_ACTIVE) { sampled = new EvictionStatisticsSampledDSO(); } else { sampled = new EvictionStatisticsSampledNoDSO(); } }
/** * Run evictor run! * * @throws RuntimeException if an error occurs */ public void run() { evictionListener.startLocalEviction(); store.evictExpiredLocalElements(); evictionListener.endLocalEviction(); }
/** * Further initialize this object and launch the eviction thread. */ public void initializeOnLoad() { this.timeSource = new SystemTimeSource(); this.evictionScheduler = new EvictionScheduler(config, new Evictor<K>(this)); this.statistics = new EvictionStatistics(); this.data.registerMapSizeListener(new TargetCapacityMapSizeListener(data, getConfig())); }
SearchMapEvictor(SearchableMap<K, V>searchMap, TimeStampInfo<K> tsInfo, CacheConfig config) { this.searchMap = searchMap; this.tsInfo = tsInfo; this.config = config; this.statistics = new EvictionStatistics(); }
public CapacityEvictionPolicyData newCapacityEvictionPolicyData() { return new LFUCapacityEvictionPolicyData(); }
private void startEviction() { // This method is also directly invoked as a "postCreate" method (ie. it will be invoked when a non-shared instance // of this class becomes shared) evictionScheduler.start(); }
/** * Get the most recent sample of the evicted entries. * <p> * The number of objects that are returned are sampled per second and the latest value is returned. */ public long getEvictedMostRecentSample() { return sampled.getEvictedMostRecentSample(); } }
/** * Construct evictor with the evictable store to evict on. No EvictionListener is specified so the * {@link NullEvictionListener} is used - this listener does not do orphan eviction. * * @param store The evictable collection */ public Evictor(Evictable<K> store) { this(store, new NullEvictionListener()); }
/** * Get the most recent sample of the examined entries. * <p> * The number of objects that are returned are sampled per second and the latest value is returned. */ public long getExaminedMostRecentSample() { return sampled.getExaminedMostRecentSample(); }
/** * Tells background thread to stop at next opportunity and kills the reference to it */ public synchronized void stop() { EvictionRunner oldRunner = this.runner; runner = null; if (oldRunner != null) { oldRunner.cancel(); } }
public EvictionRunner(final CacheConfig config, final Evictor<?> evictor) { this.evictor = evictor; this.config = config; this.evictor_max_sleep_secs = getSleepTime(EVICTOR_MAX_SLEEP_PROP, DEFAULT_MAX_EVICTOR_SLEEP); this.evictor_min_sleep_secs = getSleepTime(EVICTOR_MIN_SLEEP_PROP, DEFAULT_MIN_EVICTOR_SLEEP); }
/** * On shutdown, release the orphan evictor lock so it can be reobtained by a later evictor. */ public void onShutdown() { if (isOrphanEvictor) { isOrphanEvictor = false; orphanEvictorLock.unlock(); } }
public TargetCapacityMapSizeListener(ConcurrentDistributedMap map, CacheConfig config) { this.map = map; this.config = config; this.targetCapacityEvictor = new TargetCapacityEvictor(map); }
/** * Stop running - call lifecycle event */ public void postRun() { evictionListener.onShutdown(); }
private long calculateWakeup(long start) { return start + (getSleepTimeSeconds() * 1000); } }
public TargetCapacityEvictor(ConcurrentDistributedMap map) { this.map = map; this.capacityEvictionComparator = new CapacityEvictionPolicyComparator(); }