Class JmxUtil
java.lang.Object
org.apache.tomcat.jdbc.pool.jmx.JmxUtil
Utility class for JMX registration of JDBC pool components.
JMX is a best-effort management channel, not part of the pool's operation. A registration or an unregistration is attempted once and a failure is logged; nothing is retried later from this class.
Under Catalina the names are unique - the container assigns them, and a name identifies one live component - so a refused registration is a configuration or server problem that an operator reads from the log, not one the pool should keep hammering. Retrying a refused unregistration by name would be worse than leaving it: by the time the retry ran, the name could belong to a replacement MBean, and the retry would silently take down the replacement's management surface.
-
Method Summary
Modifier and TypeMethodDescriptionstatic ObjectNameregisterJmx(ObjectName base, String keyprop, Object obj) Register an object as an MBean.static booleanunregisterJmx(ObjectName oname) Unregister an MBean.
-
Method Details
-
registerJmx
Register an object as an MBean.- Parameters:
base- the base object name, ornullto register nothing - the skip a component whose own registration is absent relies on, so it is deliberate and unloggedkeyprop- the key propertyobj- the object to register- Returns:
- the registered object name, or
nullon failure - or on the absent-base skip. A registration the MBean server refused - because the name is already in use by another MBean, for instance - is such a failure, so a non-nullname always means this call is the one that published the object under that name
-
unregisterJmx
Unregister an MBean.- Parameters:
oname- the object name to unregister, ornullto release nothing- Returns:
trueif the name is no longer registered - either this call took it down, or it was already gone, or there was nothing to release;falseif the MBean server refused to unregister it, which means the MBean is normally still published under that name and, since callers drop their handle regardless, held by nothing for the rest of the JVM's life (an MBean whosepostDeregister()throws reports the same failure although the server already took it down; the pool's own MBeans never do). A refusal is reported here and not remembered for a later retry: see the class documentation.
-