Package org.pjdbc.jmx

Class CircuitBreakerRegistry

java.lang.Object
org.pjdbc.jmx.CircuitBreakerRegistry

public class CircuitBreakerRegistry extends Object
Registry for CircuitBreaker instances with optional JMX registration.

JMX registration is disabled by default. Enable via:

  • System property: -Dpjdbc.jmx.enabled=true
  • Programmatic: CircuitBreakerRegistry.enableJmx()

When enabled, circuit breakers are registered under: org.pjdbc:type=CircuitBreaker,name=<name>

  • Method Details

    • getInstance

      public static CircuitBreakerRegistry getInstance()
      Get the singleton registry instance.
    • enableJmx

      public static void enableJmx()
      Enable JMX registration for circuit breakers. Also registers any circuit breakers that were created before JMX was enabled.
    • disableJmx

      public static void disableJmx()
      Disable JMX registration and unregister all MBeans.
    • isJmxEnabled

      public static boolean isJmxEnabled()
      Check if JMX is enabled.
    • register

      public void register(CircuitBreakerDriver.CircuitBreaker circuitBreaker)
      Register a circuit breaker with the registry. If JMX is enabled, also registers an MBean.
    • unregister

      public void unregister(String name)
      Unregister a circuit breaker from the registry.
    • get

      Get a circuit breaker by name.
    • getNames

      public Iterable<String> getNames()
      Get all registered circuit breaker names.
    • getCount

      public int getCount()
      Get the count of registered circuit breakers.
    • clear

      public void clear()
      Clear all circuit breakers and MBeans (for testing).