Package org.pjdbc.jmx
Class CircuitBreakerRegistry
java.lang.Object
org.pjdbc.jmx.CircuitBreakerRegistry
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 Summary
Modifier and TypeMethodDescriptionvoidclear()Clear all circuit breakers and MBeans (for testing).static voidDisable JMX registration and unregister all MBeans.static voidEnable JMX registration for circuit breakers.Get a circuit breaker by name.intgetCount()Get the count of registered circuit breakers.static CircuitBreakerRegistryGet the singleton registry instance.getNames()Get all registered circuit breaker names.static booleanCheck if JMX is enabled.voidregister(CircuitBreakerDriver.CircuitBreaker circuitBreaker) Register a circuit breaker with the registry.voidunregister(String name) Unregister a circuit breaker from the registry.
-
Method Details
-
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
Register a circuit breaker with the registry. If JMX is enabled, also registers an MBean. -
unregister
Unregister a circuit breaker from the registry. -
get
Get a circuit breaker by name. -
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).
-