Class CountingCircuitStats
java.lang.Object
dev.failsafe.internal.CountingCircuitStats
- All Implemented Interfaces:
CircuitStats
A CircuitStats implementation that counts execution results using a BitSet.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) final BitSet(package private) intIndex to write next entry toprivate intprivate intprivate final intprivate int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) voidcopyStats(CircuitStats oldStats) Copies the most recent stats from theoldStatsinto this in order from oldest to newest.intintintintintprivate intindexAfter(int index) Returns the index after theindex.voidvoidvoidreset()(package private) intsetNext(boolean value) Sets the value of the next bit in the bitset, returning the previous value, else -1 if no previous value was set for the bit.toString()Returns an array representation of the BitSet entries.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface CircuitStats
copyExecutions
-
Field Details
-
bitSet
-
size
private final int size -
currentIndex
volatile int currentIndexIndex to write next entry to -
occupiedBits
private volatile int occupiedBits -
successes
private volatile int successes -
failures
private volatile int failures
-
-
Constructor Details
-
CountingCircuitStats
-
-
Method Details
-
copyStats
Copies the most recent stats from theoldStatsinto this in order from oldest to newest. -
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
-
setNext
int setNext(boolean value) Sets the value of the next bit in the bitset, returning the previous value, else -1 if no previous value was set for the bit.- Parameters:
value- true if positive/success, false if negative/failure
-
toString
-
indexAfter
private int indexAfter(int index) Returns the index after theindex.
-