alma::acs::monitoring::RemoteThreadsClient Class Reference

Collaboration diagram for alma::acs::monitoring::RemoteThreadsClient:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 RemoteThreadsClient (String className) throws RemoteThreadsException
 RemoteThreadsClient (int pid) throws RemoteThreadsException
 RemoteThreadsClient (InetAddress remoteHost) throws RemoteThreadsException
 RemoteThreadsClient (InetAddress remoteHost, int remotePort) throws RemoteThreadsException
boolean connect ()
void close () throws RemoteThreadsException
RemoteThreadsMBean getMBean () throws RemoteThreadsException

Static Public Attributes

static final int RMI_DEFAULT_PORT = 9999

Private Member Functions

int getRemotePID (String className) throws IOException
void getServiceURL (int pid) throws IOException, AgentLoadException, RemoteThreadsException, AttachNotSupportedException, AgentInitializationException
void getServiceURL (InetAddress host, int port) throws MalformedURLException

Private Attributes

JMXServiceURL remoteURL = null
MBeanServerConnection remote = null
RemoteThreadsMBean rtmb = null
JMXConnector connector = null

Static Private Attributes

static final String LOCAL_CONNECTOR_ADDRESS

Detailed Description

Class used for connecting with a 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

Author:
rtobar
Since:
ACS 7.0

Constructor & Destructor Documentation

alma::acs::monitoring::RemoteThreadsClient::RemoteThreadsClient ( String  className  )  throws RemoteThreadsException [inline]

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).

Parameters:
className The name of the launcher class of the remote process
Exceptions:
RemoteThreadsException Is thrown in the following cases:

  • The given PID isn't present in the list of java processes, or it can't be retreived by the jps program.
  • Cannot connect to the remote JVM or can't attach to it.
  • Can't load the JMX agent on the remote JVM or can't initialize it (if it isn't already loaded).

References getRemotePID(), and getServiceURL().

alma::acs::monitoring::RemoteThreadsClient::RemoteThreadsClient ( int  pid  )  throws RemoteThreadsException [inline]

Gets a new RemoteThreadsClient ready to be connected to the remote JVM indicated by the given PID

Parameters:
pid The PID of the remote java process
Exceptions:
RemoteThreadsException If:

  • PID is less or equal to 0.
  • Cannot connect to the remote JVM or can't attach to it.
  • Can't load the JMX agent on the remote JVM or can't initialize it (if it isn't already loaded).

References getServiceURL().

alma::acs::monitoring::RemoteThreadsClient::RemoteThreadsClient ( InetAddress  remoteHost  )  throws RemoteThreadsException [inline]

Gets a new 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.

Parameters:
remoteHost The remote host where the remote JVM is placed
Exceptions:
RemoteThreadsException If a malformed URL is produced with the given host address.

References getServiceURL(), and RMI_DEFAULT_PORT.

alma::acs::monitoring::RemoteThreadsClient::RemoteThreadsClient ( InetAddress  remoteHost,
int  remotePort 
) throws RemoteThreadsException [inline]

Gets a new RemoteThreadsClient ready to be connected to the remote JVM present in the given host address and port.

Parameters:
remoteHost The remote host where the remote JVM is placed
remotePort The port to be used for the RMI connection
Exceptions:
RemoteThreadsException If a malformed URL is produced with the given host address and port.

References getServiceURL().


Member Function Documentation

void alma::acs::monitoring::RemoteThreadsClient::close (  )  throws RemoteThreadsException [inline]
boolean alma::acs::monitoring::RemoteThreadsClient::connect (  )  [inline]
RemoteThreadsMBean alma::acs::monitoring::RemoteThreadsClient::getMBean (  )  throws RemoteThreadsException [inline]

Returns an object representing the MBean registered on the remote JVM agent. If the MBean has not been registered, then it is registered and then retreived.

Returns:
A RemoteThreadsMBean object representing the MBean registered on the remote JVM agent.
Exceptions:
RemoteThreadsException If:

  • The MBean can't be registered on the remote JVM agent
  • A local reference for this MBean can't be get

References remote, and rtmb.

Referenced by alma::acs::monitoring::RemoteThreadsMonitor::getMBean(), alma::acs::monitoring::RemoteThreadsMBeanTest::setUp(), alma::acs::container::corba::ContainerMonitorTest::setUp(), and alma::acs::monitoring::RemoteThreadsClientTest::testGetMBean().

int alma::acs::monitoring::RemoteThreadsClient::getRemotePID ( String  className  )  throws IOException [inline, private]

Referenced by RemoteThreadsClient().

void alma::acs::monitoring::RemoteThreadsClient::getServiceURL ( InetAddress  host,
int  port 
) throws MalformedURLException [inline, private]

References remoteURL.

void alma::acs::monitoring::RemoteThreadsClient::getServiceURL ( int  pid  )  throws IOException, AgentLoadException, RemoteThreadsException, AttachNotSupportedException, AgentInitializationException [inline, private]

References LOCAL_CONNECTOR_ADDRESS, and remoteURL.

Referenced by RemoteThreadsClient().


Member Data Documentation

Referenced by close(), and connect().

Initial value:
      "com.sun.management.jmxremote.localConnectorAddress"

Property name for getting a local JMX connector

Referenced by getServiceURL().

MBeanServerConnection alma::acs::monitoring::RemoteThreadsClient::remote = null [private]

Referenced by connect(), and getMBean().

Referenced by connect(), and getServiceURL().

Default port used by the RMI client-side connector

Referenced by RemoteThreadsClient().

Referenced by getMBean().


The documentation for this class was generated from the following file:

Generated by  doxygen 1.6.2