Package one.microstream.reference
Class Lazy.Checker.Default
java.lang.Object
one.microstream.reference.Lazy.Checker.Default
- All Implemented Interfaces:
Lazy.Checker,Lazy.ClearingEvaluator
- Enclosing interface:
- Lazy.Checker
public static final class Lazy.Checker.Default extends Object implements Lazy.Checker, Lazy.ClearingEvaluator
This implementation uses two dimensions to evaluate if a lazy reference will be cleared:
- time: a ref's "age" in terms of
- memory: the amount of used memory compared to the permitted quota of total available memory.
- time: a ref's "age" in terms of
Lazy.lastTouched() compared to System.currentTimeMillis()- memory: the amount of used memory compared to the permitted quota of total available memory.
Either dimension can be deactivated by setting its configuration value to 0.
If both are non-zero, a arithmetically combined check will make clearing of a certain reference
more like the older it gets as free memory shrinks.
So, as free memory gets lower, older/passive references are cleared sooner, newer/active ones later.
-
Nested Class Summary
Nested classes/interfaces inherited from interface one.microstream.reference.Lazy.Checker
Lazy.Checker.Default, Lazy.Checker.Defaults -
Method Summary
Modifier and Type Method Description voidbeginCheckCycle()booleancheck(Lazy<?> lazyReference)voidendCheckCycle()static longgraceTimeMinimum()static doublememoryQuotaNoCheck()booleanneedsClearing(Lazy<?> lazyReference)
-
Method Details
-
memoryQuotaNoCheck
public static double memoryQuotaNoCheck() -
graceTimeMinimum
public static long graceTimeMinimum() -
beginCheckCycle
public final void beginCheckCycle()- Specified by:
beginCheckCyclein interfaceLazy.Checker
-
endCheckCycle
public void endCheckCycle()- Specified by:
endCheckCyclein interfaceLazy.Checker
-
check
- Specified by:
checkin interfaceLazy.Checker- Parameters:
lazyReference- the lazy reference to check against- Returns:
- if additional checks should be prevented
-
needsClearing
- Specified by:
needsClearingin interfaceLazy.ClearingEvaluator
-