public class JmxHelper
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.util.Map<java.lang.String,java.lang.String> |
CLASSES |
static java.lang.String |
JMX_URL_FORMAT |
static java.lang.String |
JMXMP_URL_FORMAT |
static java.lang.String |
RMI_JMX_URL_FORMAT |
Constructor and Description |
---|
JmxHelper(Entity entity) |
JmxHelper(java.lang.String url) |
JmxHelper(java.lang.String url,
Entity entity,
java.lang.String user,
java.lang.String password) |
JmxHelper(java.lang.String url,
java.lang.String user,
java.lang.String password) |
Modifier and Type | Method and Description |
---|---|
void |
addNotificationListener(javax.management.ObjectName objectName,
javax.management.NotificationListener listener) |
void |
addNotificationListener(javax.management.ObjectName objectName,
javax.management.NotificationListener listener,
javax.management.NotificationFilter filter) |
void |
addNotificationListener(java.lang.String objectName,
javax.management.NotificationListener listener) |
void |
addNotificationListener(java.lang.String objectName,
javax.management.NotificationListener listener,
javax.management.NotificationFilter filter) |
void |
assertMBeanExistsEventually(javax.management.ObjectName objectName,
Duration timeout) |
void |
assertMBeanExistsEventually(javax.management.ObjectName objectName,
long timeoutMillis) |
void |
assertMBeanExistsEventually(javax.management.ObjectName objectName,
long timeout,
java.util.concurrent.TimeUnit timeUnit) |
void |
assertMBeanExistsEventually(javax.management.ObjectName objectName,
groovy.time.TimeDuration timeout)
Deprecated.
since 0.11.0; explicit groovy utilities/support will be deleted.
|
void |
connect()
attempts to connect immediately
|
boolean |
connect(long timeoutMs)
Continuously attempts to connect for at least the indicated amount of time; or indefinitely if -1.
|
static javax.management.ObjectName |
createObjectName(java.lang.String name) |
void |
disconnect()
A thread-safe version of
disconnectNow() . |
java.util.Set<javax.management.ObjectInstance> |
doesMBeanExistsEventually(javax.management.ObjectName objectName,
Duration timeout) |
java.util.Set<javax.management.ObjectInstance> |
doesMBeanExistsEventually(javax.management.ObjectName objectName,
long timeoutMillis) |
java.util.Set<javax.management.ObjectInstance> |
doesMBeanExistsEventually(javax.management.ObjectName objectName,
long timeout,
java.util.concurrent.TimeUnit timeUnit)
returns set of beans found, with retry, empty set if none after timeout
|
java.util.Set<javax.management.ObjectInstance> |
doesMBeanExistsEventually(javax.management.ObjectName objectName,
groovy.time.TimeDuration timeout)
Deprecated.
since 0.11.0; explicit groovy utilities/support will be deleted.
|
java.util.Set<javax.management.ObjectInstance> |
doesMBeanExistsEventually(java.lang.String objectName,
Duration timeout) |
java.util.Set<javax.management.ObjectInstance> |
doesMBeanExistsEventually(java.lang.String objectName,
long timeout,
java.util.concurrent.TimeUnit timeUnit) |
java.util.Set<javax.management.ObjectInstance> |
doesMBeanExistsEventually(java.lang.String objectName,
groovy.time.TimeDuration timeout)
Deprecated.
since 0.11.0; explicit groovy utilities/support will be deleted.
|
javax.management.ObjectInstance |
findMBean(javax.management.ObjectName objectName) |
java.util.Set<javax.management.ObjectInstance> |
findMBeans(javax.management.ObjectName objectName) |
java.lang.Object |
getAttribute(javax.management.ObjectName objectName,
java.lang.String attribute)
Returns a specific attribute for a JMX
ObjectName . |
java.util.Map |
getConnectionEnvVars() |
<M> M |
getProxyObject(javax.management.ObjectName objectName,
java.lang.Class<M> mbeanInterface) |
<M> M |
getProxyObject(java.lang.String objectName,
java.lang.Class<M> mbeanInterface) |
java.lang.String |
getUrl() |
boolean |
isConnected()
Checks if the JmxHelper is connected.
|
static javax.management.remote.JMXConnector |
newConnector(javax.management.remote.JMXServiceURL url,
java.util.Map<java.lang.String,?> env)
Handles loading the
JMXConnector in OSGi, where we need to supply the classloader. |
java.lang.Object |
operation(javax.management.ObjectName objectName,
java.lang.String method,
java.lang.Object... arguments)
Executes an operation on a JMX
ObjectName . |
java.lang.Object |
operation(java.lang.String objectName,
java.lang.String method,
java.lang.Object... arguments) |
void |
reconnect() |
void |
reconnectWithRetryDampened()
Reconnects.
|
void |
removeNotificationListener(javax.management.ObjectName objectName,
javax.management.NotificationListener listener) |
void |
removeNotificationListener(javax.management.ObjectName objectName,
javax.management.NotificationListener listener,
javax.management.NotificationFilter filter) |
void |
removeNotificationListener(java.lang.String objectName,
javax.management.NotificationListener listener) |
void |
setAttribute(javax.management.ObjectName objectName,
java.lang.String attribute,
java.lang.Object val) |
void |
setAttribute(java.lang.String objectName,
java.lang.String attribute,
java.lang.Object val) |
void |
setMinTimeBetweenReconnectAttempts(int val) |
void |
terminate()
Disconnects, preventing subsequent connections to be made.
|
static java.lang.String |
toJmxmpUrl(java.lang.String host,
java.lang.Integer jmxmpPort)
constructs a JMXMP URL for connecting to the given host and port
|
static java.lang.String |
toJmxUrl(Entity entity)
constructs a JMX URL suitable for connecting to the given entity, being smart about JMX/RMI vs JMXMP
|
javax.management.ObjectName |
toLiteralObjectName(javax.management.ObjectName objectName)
Converts from an object name pattern to a real object name, by querying with findMBean;
if no matching MBean can be found (or if more than one match found) then returns null.
|
static java.lang.String |
toRmiJmxUrl(java.lang.String host,
java.lang.Integer jmxRmiServerPort,
java.lang.Integer rmiRegistryPort,
java.lang.String context)
constructs an RMI/JMX URL with the given inputs
(where the RMI Registry Port should be non-null, and at least one must be non-null)
|
public static final java.lang.String JMX_URL_FORMAT
public static final java.lang.String RMI_JMX_URL_FORMAT
public static final java.lang.String JMXMP_URL_FORMAT
public static final java.util.Map<java.lang.String,java.lang.String> CLASSES
public JmxHelper(Entity entity)
public JmxHelper(java.lang.String url)
public JmxHelper(java.lang.String url, java.lang.String user, java.lang.String password)
public JmxHelper(java.lang.String url, Entity entity, java.lang.String user, java.lang.String password)
public static java.lang.String toJmxUrl(Entity entity)
public static java.lang.String toRmiJmxUrl(java.lang.String host, java.lang.Integer jmxRmiServerPort, java.lang.Integer rmiRegistryPort, java.lang.String context)
public static java.lang.String toJmxmpUrl(java.lang.String host, java.lang.Integer jmxmpPort)
public void setMinTimeBetweenReconnectAttempts(int val)
public java.lang.String getUrl()
public boolean isConnected()
public void reconnectWithRetryDampened() throws java.io.IOException
java.io.IOException
public void reconnect() throws java.io.IOException
java.io.IOException
public void connect() throws java.io.IOException
java.io.IOException
public static javax.management.remote.JMXConnector newConnector(javax.management.remote.JMXServiceURL url, java.util.Map<java.lang.String,?> env) throws java.io.IOException
JMXConnector
in OSGi, where we need to supply the classloader.java.io.IOException
public java.util.Map getConnectionEnvVars()
public boolean connect(long timeoutMs)
timeoutMs
- public void disconnect()
disconnectNow()
.
This method is threadsafe.public void terminate()
public javax.management.ObjectName toLiteralObjectName(javax.management.ObjectName objectName)
public java.util.Set<javax.management.ObjectInstance> findMBeans(javax.management.ObjectName objectName)
public javax.management.ObjectInstance findMBean(javax.management.ObjectName objectName)
public java.util.Set<javax.management.ObjectInstance> doesMBeanExistsEventually(javax.management.ObjectName objectName, Duration timeout)
@Deprecated public java.util.Set<javax.management.ObjectInstance> doesMBeanExistsEventually(javax.management.ObjectName objectName, groovy.time.TimeDuration timeout)
public java.util.Set<javax.management.ObjectInstance> doesMBeanExistsEventually(javax.management.ObjectName objectName, long timeoutMillis)
public java.util.Set<javax.management.ObjectInstance> doesMBeanExistsEventually(java.lang.String objectName, Duration timeout)
@Deprecated public java.util.Set<javax.management.ObjectInstance> doesMBeanExistsEventually(java.lang.String objectName, groovy.time.TimeDuration timeout)
public java.util.Set<javax.management.ObjectInstance> doesMBeanExistsEventually(java.lang.String objectName, long timeout, java.util.concurrent.TimeUnit timeUnit)
public java.util.Set<javax.management.ObjectInstance> doesMBeanExistsEventually(javax.management.ObjectName objectName, long timeout, java.util.concurrent.TimeUnit timeUnit)
public void assertMBeanExistsEventually(javax.management.ObjectName objectName, Duration timeout)
@Deprecated public void assertMBeanExistsEventually(javax.management.ObjectName objectName, groovy.time.TimeDuration timeout)
public void assertMBeanExistsEventually(javax.management.ObjectName objectName, long timeoutMillis)
public void assertMBeanExistsEventually(javax.management.ObjectName objectName, long timeout, java.util.concurrent.TimeUnit timeUnit)
public java.lang.Object getAttribute(javax.management.ObjectName objectName, java.lang.String attribute)
ObjectName
.public void setAttribute(java.lang.String objectName, java.lang.String attribute, java.lang.Object val)
public void setAttribute(javax.management.ObjectName objectName, java.lang.String attribute, java.lang.Object val)
public java.lang.Object operation(java.lang.String objectName, java.lang.String method, java.lang.Object... arguments)
#operation(ObjectName, String, Object ...)
public java.lang.Object operation(javax.management.ObjectName objectName, java.lang.String method, java.lang.Object... arguments)
ObjectName
.public void addNotificationListener(java.lang.String objectName, javax.management.NotificationListener listener)
public void addNotificationListener(java.lang.String objectName, javax.management.NotificationListener listener, javax.management.NotificationFilter filter)
public void addNotificationListener(javax.management.ObjectName objectName, javax.management.NotificationListener listener)
public void addNotificationListener(javax.management.ObjectName objectName, javax.management.NotificationListener listener, javax.management.NotificationFilter filter)
public void removeNotificationListener(java.lang.String objectName, javax.management.NotificationListener listener)
public void removeNotificationListener(javax.management.ObjectName objectName, javax.management.NotificationListener listener)
public void removeNotificationListener(javax.management.ObjectName objectName, javax.management.NotificationListener listener, javax.management.NotificationFilter filter)
public <M> M getProxyObject(java.lang.String objectName, java.lang.Class<M> mbeanInterface)
public <M> M getProxyObject(javax.management.ObjectName objectName, java.lang.Class<M> mbeanInterface)
public static javax.management.ObjectName createObjectName(java.lang.String name)