Execute body with JMX connection specified by opts. opts can also
include an optional :environment key which is passed as the
environment arg to JMXConnectorFactory/connect.
(defmacro with-connection
"Execute body with JMX connection specified by opts. opts can also
include an optional :environment key which is passed as the
environment arg to JMXConnectorFactory/connect."
[opts & body]
`(let [opts# ~opts
env# (get opts# :environment {})
opts# (dissoc opts# :environment)]
(with-open [connector# (javax.management.remote.JMXConnectorFactory/connect
(JMXServiceURL. (jmx-url opts#)) env#)]
(binding [*connection* (.getMBeanServerConnection connector#)]
~@body))))
Comments top
No comments for with-connection. Log in to add a comment.