Class EventCountCircuitBreaker.CheckIntervalData

  • Enclosing class:
    EventCountCircuitBreaker

    private static class EventCountCircuitBreaker.CheckIntervalData
    extends java.lang.Object
    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

      Fields 
      Modifier and Type Field Description
      private long checkIntervalStart
      The start time of the current check interval.
      private int eventCount
      The counter for events.
    • Constructor Summary

      Constructors 
      Constructor Description
      CheckIntervalData​(int count, long intervalStart)
      Creates a new instance of CheckIntervalData.
    • Field Detail

      • eventCount

        private final int eventCount
        The counter for events.
      • checkIntervalStart

        private final long checkIntervalStart
        The start time of the current check interval.
    • Constructor Detail

      • CheckIntervalData

        CheckIntervalData​(int count,
                          long intervalStart)
        Creates a new instance of CheckIntervalData.
        Parameters:
        count - the current count value
        intervalStart - the start time of the check interval
    • Method Detail

      • 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

        public EventCountCircuitBreaker.CheckIntervalData increment​(int delta)
        Returns a new instance of CheckIntervalData 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