|
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.jppf.utils.ThreadSynchronization
org.jppf.management.JMXConnectionWrapper
public class JMXConnectionWrapper
Wrapper around a JMX connection, providing a thread-safe way of handling disconnections and recovery.
| Field Summary | |
|---|---|
protected boolean |
local
Determines whether the connection to the JMX server has been established. |
| Fields inherited from class org.jppf.utils.ThreadSynchronization |
|---|
stopped |
| Constructor Summary | |
|---|---|
JMXConnectionWrapper()
Initialize a local connection (same JVM) to the MBean server. |
|
JMXConnectionWrapper(String host,
int port,
String rmiSuffix)
Initialize the connection to the remote MBean server. |
|
| Method Summary | ||
|---|---|---|
void |
close()
Close the connection to the remote MBean server. |
|
void |
connect()
Initialize the connection to the remote MBean server. |
|
void |
connectAndWait(long timeout)
Initiate the connection and wait until the connection is established or the timeout has expired, whichever comes first. |
|
Object |
getAttribute(String name,
String attribute)
Get the value of an attribute of the specified MBean. |
|
String |
getHost()
Get the host the server is running on. |
|
String |
getId()
Get a string describing this connection. |
|
MBeanServerConnection |
getMbeanConnection()
Get the connection to the MBean server. |
|
int |
getPort()
Get the RMI port used by the server. |
|
|
getProxy(ObjectName objectName,
Class<T> inf)
Obtain a proxy to the soecified remote MBean. |
|
|
getProxy(String name,
Class<T> inf)
Obtain a proxy to the soecified remote MBean. |
|
Object |
invoke(String name,
String methodName,
Object[] params,
String[] signature)
Invoke a method on the specified MBean. |
|
boolean |
isConnected()
Determines whether the connection to the JMX server has been established. |
|
protected void |
setConnectedStatus(boolean status)
Set the connected state of this conenction wrapper. |
|
| Methods inherited from class org.jppf.utils.ThreadSynchronization |
|---|
goToSleep, goToSleep, goToSleep, isStopped, setStopped, wakeUp |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected boolean local
| Constructor Detail |
|---|
public JMXConnectionWrapper()
public JMXConnectionWrapper(String host,
int port,
String rmiSuffix)
host - the host the server is running on.port - the RMI port used by the server.rmiSuffix - RMI registry namespace suffix.| Method Detail |
|---|
public void connect()
public void connectAndWait(long timeout)
timeout - the maximum time to wait for, a value of zero means no timeout and
this method just waits until the connection is established.
public void close()
throws Exception
Exception - if the connection could not be closed.
public Object invoke(String name,
String methodName,
Object[] params,
String[] signature)
throws Exception
name - the name of the MBean.methodName - the name of the method to invoke.params - the method parameter values.signature - the types of the method parameters.
Exception - if the invocation failed.
public Object getAttribute(String name,
String attribute)
throws Exception
name - the name of the MBean.attribute - the name of the attribute to read.
Exception - if the invocation failed.public String getHost()
public int getPort()
public String getId()
public MBeanServerConnection getMbeanConnection()
MBeanServerConnection instance.protected void setConnectedStatus(boolean status)
status - true if the jmx connection is established, false otherwise.public boolean isConnected()
public <T> T getProxy(String name,
Class<T> inf)
throws Exception
T - the type of the MBean (must be an interface).name - the name of the mbean to retrieve.inf - the class of the MBean interface.
Exception - if any error occurs.
public <T> T getProxy(ObjectName objectName,
Class<T> inf)
throws Exception
T - the type of the MBean (must be an interface).objectName - the name of the mbean to retrieve.inf - the class of the MBean interface.
Exception - if any error occurs.
|
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||