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
-
Constructor Summary
Constructors Constructor Description Default()
-
Method Summary
Modifier and Type Method Description void
beginCheckCycle()
boolean
check(Lazy<?> lazyReference)
void
endCheckCycle()
static long
graceTimeMinimum()
static double
memoryQuotaNoCheck()
boolean
needsClearing(Lazy<?> lazyReference)
-
Constructor Details
-
Default
public Default()
-
-
Method Details
-
memoryQuotaNoCheck
public static double memoryQuotaNoCheck() -
graceTimeMinimum
public static long graceTimeMinimum() -
beginCheckCycle
public final void beginCheckCycle()- Specified by:
beginCheckCycle
in interfaceLazy.Checker
-
endCheckCycle
public void endCheckCycle()- Specified by:
endCheckCycle
in interfaceLazy.Checker
-
check
- Specified by:
check
in interfaceLazy.Checker
- Parameters:
lazyReference
- the lazy reference to check against- Returns:
- if additional checks should be prevented
-
needsClearing
- Specified by:
needsClearing
in interfaceLazy.ClearingEvaluator
-