Class BreakerService

java.lang.Object
com.peterphi.std.guice.common.breaker.BreakerService

public class BreakerService extends Object
Service that returns Breakers that depend on one or more of a group of underlying named breakers.
Current implementation is designed for manual (and therefore low volume) tripping
  • Constructor Details

    • BreakerService

      @Inject public BreakerService(com.codahale.metrics.MetricRegistry metrics, BreakerPersistStore persist)
  • Method Details

    • register

      public Breaker register(Consumer<Boolean> onChange, List<String> names)
      Create a new Breaker which trips if any of the named breakers are tripped
      Parameters:
      onChange - a method to call when trip/reset occurs; this method should return quickly
      names - the group names (e.g "all", "SomeDaemon", "NonTransactionalDaemons")
      Returns:
      an isolator that will break if
    • getAllBreakerNames

      public List<String> getAllBreakerNames()
    • getTripRecord

      public TripRecord getTripRecord(String name)
    • set

      public void set(String name, boolean value, String note)
      Change the state of a named breaker
      Parameters:
      name - the name of the breaker
      value - the new state
      note - the optional description of why the state has changed