Class TimedCircuitStats
java.lang.Object
dev.failsafe.internal.TimedCircuitStats
- All Implemented Interfaces:
CircuitStats
A CircuitStats implementation that counts execution results within a time period, and buckets results to
minimize overhead.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class(package private) static class(package private) static class -
Field Summary
FieldsModifier and TypeFieldDescription(package private) final TimedCircuitStats.Bucket[]private final longprivate final TimedCircuitStats.Clock(package private) int(package private) static final intprivate final TimedCircuitStats.Statprivate final long -
Constructor Summary
ConstructorsConstructorDescriptionTimedCircuitStats(int bucketCount, Duration thresholdingPeriod, TimedCircuitStats.Clock clock, CircuitStats oldStats) -
Method Summary
Modifier and TypeMethodDescription(package private) voidcopyStats(CircuitStats oldStats) Copies the most recent stats from theoldStatsinto this in order from oldest to newest and orders buckets from oldest to newest, with uninitialized buckets counting as oldest.(package private) TimedCircuitStats.BucketReturns the current bucket based on the current time, moving the internal storage to the current bucket if necessary, resetting bucket stats along the way.intintintintintprivate intindexAfter(int index) Returns the index after theindex.private intindexBefore(int index) Returns the index before theindex.private intReturns the next index.voidvoidvoidreset()toString()Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface CircuitStats
copyExecutions
-
Field Details
-
DEFAULT_BUCKET_COUNT
static final int DEFAULT_BUCKET_COUNT- See Also:
-
clock
-
bucketSizeMillis
private final long bucketSizeMillis -
windowSizeMillis
private final long windowSizeMillis -
buckets
-
summary
-
currentIndex
volatile int currentIndex
-
-
Constructor Details
-
TimedCircuitStats
public TimedCircuitStats(int bucketCount, Duration thresholdingPeriod, TimedCircuitStats.Clock clock, CircuitStats oldStats)
-
-
Method Details
-
copyStats
Copies the most recent stats from theoldStatsinto this in order from oldest to newest and orders buckets from oldest to newest, with uninitialized buckets counting as oldest. -
recordSuccess
public void recordSuccess()- Specified by:
recordSuccessin interfaceCircuitStats
-
recordFailure
public void recordFailure()- Specified by:
recordFailurein interfaceCircuitStats
-
getExecutionCount
public int getExecutionCount()- Specified by:
getExecutionCountin interfaceCircuitStats
-
getFailureCount
public int getFailureCount()- Specified by:
getFailureCountin interfaceCircuitStats
-
getFailureRate
public int getFailureRate()- Specified by:
getFailureRatein interfaceCircuitStats
-
getSuccessCount
public int getSuccessCount()- Specified by:
getSuccessCountin interfaceCircuitStats
-
getSuccessRate
public int getSuccessRate()- Specified by:
getSuccessRatein interfaceCircuitStats
-
reset
public void reset()- Specified by:
resetin interfaceCircuitStats
-
getCurrentBucket
TimedCircuitStats.Bucket getCurrentBucket()Returns the current bucket based on the current time, moving the internal storage to the current bucket if necessary, resetting bucket stats along the way. -
nextIndex
private int nextIndex()Returns the next index. -
indexAfter
private int indexAfter(int index) Returns the index after theindex. -
indexBefore
private int indexBefore(int index) Returns the index before theindex. -
toString
-