Class TimedCircuitStats

java.lang.Object
dev.failsafe.internal.TimedCircuitStats
All Implemented Interfaces:
CircuitStats

class TimedCircuitStats extends Object implements CircuitStats
A CircuitStats implementation that counts execution results within a time period, and buckets results to minimize overhead.
  • Field Details

  • Constructor Details

  • Method Details

    • copyStats

      void copyStats(CircuitStats oldStats)
      Copies the most recent stats from the oldStats into 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:
      recordSuccess in interface CircuitStats
    • recordFailure

      public void recordFailure()
      Specified by:
      recordFailure in interface CircuitStats
    • getExecutionCount

      public int getExecutionCount()
      Specified by:
      getExecutionCount in interface CircuitStats
    • getFailureCount

      public int getFailureCount()
      Specified by:
      getFailureCount in interface CircuitStats
    • getFailureRate

      public int getFailureRate()
      Specified by:
      getFailureRate in interface CircuitStats
    • getSuccessCount

      public int getSuccessCount()
      Specified by:
      getSuccessCount in interface CircuitStats
    • getSuccessRate

      public int getSuccessRate()
      Specified by:
      getSuccessRate in interface CircuitStats
    • reset

      public void reset()
      Specified by:
      reset in interface CircuitStats
    • 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 the index.
    • indexBefore

      private int indexBefore(int index)
      Returns the index before the index.
    • toString

      public String toString()
      Overrides:
      toString in class Object