public final class JMXClientHelper extends Object
disconnect()
method.Modifier and Type | Field and Description |
---|---|
static String |
PA_JMX_CLIENT_PROTOCOL
The name of the java property that defines the
JMXTransportProtocol used by JMX client |
Constructor and Description |
---|
JMXClientHelper(Authentication auth,
Map<String,Object> env)
Creates a new instance of this helper.
|
JMXClientHelper(Authentication auth,
Object[] creds)
Creates a new instance of this helper and puts the credentials in the environment
used by the JMXConnector.
|
Modifier and Type | Method and Description |
---|---|
boolean |
connect()
Establishes the connection to the connector server by calling
connect(JMXTransportProtocol)
using the JMXTransportProtocol specified by the PA_JMX_CLIENT_PROTOCOL property
that can be JMXTransportProtocol.RMI or JMXTransportProtocol.RO . |
boolean |
connect(JMXTransportProtocol protocol)
Establishes the connection to the connector server.
|
void |
disconnect()
Disconnects the connector of this helper.
|
JMXConnector |
getConnector()
Returns the connected JMXConnector.
|
Exception |
getLastException()
Returns the last happened exception.
|
boolean |
isConnected()
Returns true if this client is connected.
|
static JMXConnector |
tryJMXoverRMI(Authentication auth,
Map<String,Object> env)
Tries to create a a JMXConnector over RMI, with a fall back solution over RO.
|
static JMXConnector |
tryJMXoverRO(Authentication auth,
Map<String,Object> env)
Tries to create a a JMXConnector over RO.
|
public static final String PA_JMX_CLIENT_PROTOCOL
JMXTransportProtocol
used by JMX clientpublic JMXClientHelper(Authentication auth, Object[] creds)
auth
- the authentication interfacecreds
- the array that contains credentialspublic JMXClientHelper(Authentication auth, Map<String,Object> env)
auth
- the authentication interfaceenv
- the environment used by the JMXConnectorpublic boolean connect()
connect(JMXTransportProtocol)
using the JMXTransportProtocol specified by the PA_JMX_CLIENT_PROTOCOL
property
that can be JMXTransportProtocol.RMI
or JMXTransportProtocol.RO
.
If the property is not defined the JMXTransportProtocol.RMI
protocol is used.true
if this helper is connected otherwise return false
public boolean connect(JMXTransportProtocol protocol)
protocol
- the JMXTransportProtocol
true
if this helper is connected and false
otherwisepublic boolean isConnected()
true
if this client helper is connected otherwise return false
public void disconnect()
public JMXConnector getConnector()
public Exception getLastException()
public static JMXConnector tryJMXoverRMI(Authentication auth, Map<String,Object> env)
auth
- the authentication interfaceenv
- the environment that may contains credentialspublic static JMXConnector tryJMXoverRO(Authentication auth, Map<String,Object> env)
auth
- the authentication interfaceenv
- the environment that may contains credentials