Class RollingWindowHealthQueue

java.lang.Object
io.appform.ranger.core.healthservice.monitor.RollingWindowHealthQueue

public class RollingWindowHealthQueue extends Object
This class may be used to keep track of health in a rolling window Maintains a queue of HealthcheckStatuss of size rollingWindowSize
  • Constructor Details

    • RollingWindowHealthQueue

      public RollingWindowHealthQueue(Integer rollingWindowSize, Integer maxFailures)
      Parameters:
      rollingWindowSize - size of the rolling window to be maintained
      maxFailures - maximum failures allowed in the window
  • Method Details

    • checkInRollingWindow

      public boolean checkInRollingWindow(HealthcheckStatus currentHealthStatus)
      dequeues the latest incoming status, enqueues the latest health status updates the failure counts accordingly
      Parameters:
      currentHealthStatus - current health status coming from outside
      Returns:
      true if the current failures in the queue are less than the maxFailure false if the current failures in the queue are more than or equal to the maxFailures