public class RemoteThreadsClient
extends java.lang.Object
RemoteThreads MBean implementation.
The connection can be done with a local process, as well as with a process
running in a remote machine, with the RMI connector enabled on it.
For further details on the activation of the RMI connector, you can see http://java.sun.com/docs/books/tutorial/jmx/remote/jconsole.html
| Modifier and Type | Field and Description |
|---|---|
static int |
RMI_DEFAULT_PORT
Default port used by the RMI client-side connector
|
| Constructor and Description |
|---|
RemoteThreadsClient(java.net.InetAddress remoteHost)
Gets a new
RemoteThreadsClient ready to be connected to the
remote JVM present in the given host address. |
RemoteThreadsClient(java.net.InetAddress remoteHost,
int remotePort)
Gets a new
RemoteThreadsClient ready to be connected to the
remote JVM present in the given host address and port. |
RemoteThreadsClient(int pid)
Gets a new
RemoteThreadsClient ready to be connected to the
remote JVM indicated by the given PID |
RemoteThreadsClient(java.lang.String className)
Gets a new
RemoteThreadsClient ready to be connected to the
remote JVM indicated by the name of the launcher class (the one containing the
public static void main(String[]) method). |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the connection with the remote MBeanServer.
|
boolean |
connect()
Connects the object instance to the remote JVM agent and gets a direct connection
with the MBeanServer in order to be able to get the remote MBean.
|
RemoteThreadsMBean |
getMBean()
Returns an object representing the MBean registered on the remote JVM agent.
|
public static final int RMI_DEFAULT_PORT
public RemoteThreadsClient(java.lang.String className)
throws RemoteThreadsException
RemoteThreadsClient ready to be connected to the
remote JVM indicated by the name of the launcher class (the one containing the
public static void main(String[]) method).className - The name of the launcher class of the remote processRemoteThreadsException - Is thrown in the following cases:
jps program.public RemoteThreadsClient(int pid)
throws RemoteThreadsException
RemoteThreadsClient ready to be connected to the
remote JVM indicated by the given PIDpid - The PID of the remote java processRemoteThreadsException - If:
public RemoteThreadsClient(java.net.InetAddress remoteHost)
throws RemoteThreadsException
RemoteThreadsClient ready to be connected to the
remote JVM present in the given host address. It uses the RMI_DEFAULT_PORT
for connecting to the remote host.remoteHost - The remote host where the remote JVM is placedRemoteThreadsException - If a malformed URL is produced with the given
host address.public RemoteThreadsClient(java.net.InetAddress remoteHost,
int remotePort)
throws RemoteThreadsException
RemoteThreadsClient ready to be connected to the
remote JVM present in the given host address and port.remoteHost - The remote host where the remote JVM is placedremotePort - The port to be used for the RMI connectionRemoteThreadsException - If a malformed URL is produced with the given
host address and port.public boolean connect()
public void close()
throws RemoteThreadsException
RemoteThreadsException - If the connection has not been opened.public RemoteThreadsMBean getMBean() throws RemoteThreadsException
RemoteThreadsMBean object representing the MBean registered
on the remote JVM agent.RemoteThreadsException - If: