Package ch.qos.logback.core.util
Class DefaultInvocationGate
- java.lang.Object
-
- ch.qos.logback.core.util.DefaultInvocationGate
-
- All Implemented Interfaces:
InvocationGate
public class DefaultInvocationGate extends java.lang.Object implements InvocationGate
This class serves as a gateway for invocations of a "costly" operation on a critical execution path.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static intDEFAULT_MASKprivate longinvocationCounter(package private) longlowerLimitForMaskMatchprivate longmask(package private) static intMASK_DECREASE_RIGHT_SHIFT_COUNTprivate static longMASK_DECREASE_THRESHOLDprivate static longMASK_INCREASE_THRESHOLDprivate static intMAX_MASKprivate longmaxDelayThresholdprivate longminDelayThreshold(package private) longupperLimitForNoMaskMatch-
Fields inherited from interface ch.qos.logback.core.util.InvocationGate
TIME_UNAVAILABLE
-
-
Constructor Summary
Constructors Constructor Description DefaultInvocationGate()DefaultInvocationGate(long minDelayThreshold, long maxDelayThreshold, long currentTime)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voiddecreaseMask()longgetInvocationCounter()(package private) longgetMask()private voidincreaseMask()booleanisTooSoon(long currentTime)The caller of this method can decide to skip further work if the returned value is true.private voidupdateLimits(long currentTime)
-
-
-
Field Detail
-
MASK_DECREASE_RIGHT_SHIFT_COUNT
static final int MASK_DECREASE_RIGHT_SHIFT_COUNT
- See Also:
- Constant Field Values
-
MAX_MASK
private static final int MAX_MASK
- See Also:
- Constant Field Values
-
DEFAULT_MASK
static final int DEFAULT_MASK
- See Also:
- Constant Field Values
-
mask
private volatile long mask
-
invocationCounter
private long invocationCounter
-
MASK_INCREASE_THRESHOLD
private static final long MASK_INCREASE_THRESHOLD
- See Also:
- Constant Field Values
-
MASK_DECREASE_THRESHOLD
private static final long MASK_DECREASE_THRESHOLD
- See Also:
- Constant Field Values
-
minDelayThreshold
private long minDelayThreshold
-
maxDelayThreshold
private long maxDelayThreshold
-
lowerLimitForMaskMatch
long lowerLimitForMaskMatch
-
upperLimitForNoMaskMatch
long upperLimitForNoMaskMatch
-
-
Method Detail
-
isTooSoon
public final boolean isTooSoon(long currentTime)
Description copied from interface:InvocationGateThe caller of this method can decide to skip further work if the returned value is true. Implementations should be able to give a reasonable answer even if current time date is unavailable.- Specified by:
isTooSoonin interfaceInvocationGate- Returns:
- if true, caller should skip further work
-
updateLimits
private void updateLimits(long currentTime)
-
getMask
long getMask()
-
increaseMask
private void increaseMask()
-
decreaseMask
private void decreaseMask()
-
getInvocationCounter
public long getInvocationCounter()
-
-