Class EventCountCircuitBreaker.CheckIntervalData
java.lang.Object
org.apache.commons.lang3.concurrent.EventCountCircuitBreaker.CheckIntervalData
- Enclosing class:
- EventCountCircuitBreaker
An internally used data class holding information about the checks performed by
this class. Basically, the number of received events and the start time of the
current check interval are stored.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final long
The start time of the current check interval.private final int
The counter for events. -
Constructor Summary
ConstructorsConstructorDescriptionCheckIntervalData
(int count, long intervalStart) Creates a new instance ofCheckIntervalData
. -
Method Summary
Modifier and TypeMethodDescriptionlong
Returns the start time of the current check interval.int
Returns the event counter.increment
(int delta) Returns a new instance ofCheckIntervalData
with the event counter incremented by the given delta.
-
Field Details
-
eventCount
private final int eventCountThe counter for events. -
checkIntervalStart
private final long checkIntervalStartThe start time of the current check interval.
-
-
Constructor Details
-
CheckIntervalData
CheckIntervalData(int count, long intervalStart) Creates a new instance ofCheckIntervalData
.- Parameters:
count
- the current count valueintervalStart
- the start time of the check interval
-
-
Method Details
-
getEventCount
public int getEventCount()Returns the event counter.- Returns:
- the number of received events
-
getCheckIntervalStart
public long getCheckIntervalStart()Returns the start time of the current check interval.- Returns:
- the check interval start time
-
increment
Returns a new instance ofCheckIntervalData
with the event counter incremented by the given delta. If the delta is 0, this object is returned.- Parameters:
delta
- the delta- Returns:
- the updated instance
-