This page describes an older version of the product. The latest stable version is 16.4.

JMX Management


The Java Management Extensions (JMX specification) describe an architecture, design patterns, API’s, and services for application and network management in the Java programming language. JMX functions beyond a simple API since it can specify the architecture as to how that API is used. It provides the means to construct Java code, create smart Java agents, implement distributed management middleware and managers, and integrate these solutions smoothly into existing management systems. You can integrate such solutions with either HTML or industry standards such as SNMP and WBEM. JMX is dynamic, allowing the monitoring and management of resources in real time while they are created, installed, and implemented. The JMX also works along with JVM, the Java Virtual Machine.

See also:
For more details about JMX, refer to: JavaManagement.

Manageable Resource

A JMX manageable resource can be an application, an implementation of a service, a device, a user, etc. It is developed in Java, or at least offers a Java wrapper, and must also be implemented by a Java object called a managed bean (MBeans), according to JMX specifications.

Opening JMX

Step 1. The easiest way to open JConsole for a specific service is through the GigaSpaces Management Center:
- In the Deployments tab, right-click the GSC, GSM, or LookupService tree node, or
- In the Space Browser tab:
- In the Grid Tree, right-click the relevant space container node, or

space_JMX_1_GMC_space_LaunchingJConsoleFromContainerNode_6.5.jpg

  • Right-click the relevant space node or clustered space node, or

space_JMX_2_GMC_space_LaunchingJConsoleFromSpaceNode_6.5.jpg

space_JMX_3_GMC_space_network_LaunchingJconsole_6.5.jpg

Step 2. Click Launch JConsole.
Step 3. This opens the JConsole (only if you are running JDK 1.5 and above) of the selected process.
Step 4. You can browse the various MBeans.
Step 5. Make sure you have a deployed space.
Step 6. Open a console and type the following command: jconsole

Note

By default, operations in the MBeans Operations tab which have XAP classes as their type are disabled. To enable these, type in your console:
jconsole -J-Djava.class.path=%JAVA_HOME%\lib\jconsole.jar;GS_HOME\lib\required\xap-datagrid.jar
Instead of GS_HOME, type the directory in which GigaSpaces is installed on your computer.

Step 7. Connect to the MBean server (choose one of the following options):

  • Using the Advanced tab: a. The JConsole: Connect to Agent window appears. Select the Advanced tab.

    b. In the JMX URL text box, copy the URL in the log message displayed in your GigaSpaces Server,for example:

    c. Press Connect.

New JMXConnectionServer was successfully registered into the MBeanServer using service url: service:jmx:rmi:///jndi/rmi://localhost:10098/jmxrmi

space_JMX_4_space_JMX_IMG992.gif

  • Using the Remote tab:

    a. The JConsole: Connect to Agent window appears. Select the Remote tab.

    b. In the Host or IP text box, copy the host name/IP address from JNDI URL text field in the container configuration.

    c. In the Port text box, copy the port value from the same JNDI URL text field in the container configuration.

space_JMX_5_GMC_space_containerNodeSelected_directoy_services_tab_6.1.jpg

space_JMX_6_jconsole_connect.jpg

Step 8. Press Connect.
Here is a code example of implementing such an approach:

IJSpace spaceProxy = ( IJSpace )SpaceFinder.find( "jini://mySpace_container/mySpace");
System.out.println( "Space found: " + spaceProxy.toString() );
ContainerConfig containerConfig = ( ( IJSpaceContainerAdmin )spaceProxy.getContainer() ).getConfig();
String jndiURL = containerConfig.jndiUrl;
Runtime.getRuntime().exec( "jconsole " + jndiURL );

Remote JConsole connection

In order to enable monitoring and management from remote systems using JMX jconsole set the following system properties or use the setenv shell variable REMOTE_JMX

REMOTE_JMX=-Dcom.sun.management.jmxremote.port=5001 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false
Note

For secure JConsole use -Dcom.gigaspaces.system.registryRetries=1 and -Dcom.gigaspaces.system.registryPort=5001 (same as the -Dcom.sun.management.jmxremote.port)

Viewing Thread CPU Usage with JDK 1.6

JConsole includes a new tab that displays CPU usage for each JVM thread. This tab is displayed using the -pluginpath JConsole parameter (already implemented in GigaSpaces).

To view this tab in your JConsole:

  • Install JDK 1.6 – download JDK 6 Update 2 as seen below:

space_JMX_7_JDK6.jpg

topthreads-1.0.0.jar is used by default. If topthreads-1.0.0.jar isn’t found, the JTop.jar file (which is part of the JDK) is used instead.

Below are some example screenshots:

topthread.jar

space_JMX_8_top_threads.jpg

JTop.jar

space_JMX_9_j_top.jpg

MBeans View

The jconsole utility (part of Sun J2SE 5.0 JDK and above) includes a MBeans view, which allows you to perform space administration operations, and to view and control space attributes. These operations are defined in the JavaSpaceMBeanDescriptors.xml file, which exists in the xap-datagrid.jar file. If you do not want a certain operation or attribute to be exposed in the JMX MBeans tab, simply comment or remove the operation from the XML file.

Space Container MBean

The container MBean exposes the space container’s attributes and operations. The space container manages the space life cycle.

Attributes Tab

The container Attributes tab displays a list of container attributes. Attribute values appearing in blue can be controlled, while values in black can not be changed. Red values are unavailable.

space_JMX_10_IMG994.gif

Operations Tab

The container Operations tab allows you to perform different space container operations:

Option Description
shutdown shuts down this container.
restart restarts this container.
destroySpace destroys a space in this container (type the space’s name in the spaceName text box).
createSpace (spaceName, schemaName, clusterConfigURL) creates a space with a unique name in this container and writes the created space to the appropriate Storage Adapter. (Type the name of the space, the name of the schema, and the cluster configuration URL\*\*\* in the relevant text boxes).
createSpace (spaceName, schemaName) creates a space with a unique name in this container.
getRuntimeConfigReport displays a runtime configuration report. For more details, refer to the Runtime Configuration Report section.

space_JMX_11_IMG995.gif

Info Tab

The container Info tab displays the MBean name and its Java class.

space_JMX_12_IMG996.gif

Space MBean

The Space MBean exposes space attributes and operations. You can get the basic space operational settings using this MBean.

Attributes Tab

The space Attributes tab displays a list of space attributes/elements by XPath, in the selected space. Attribute values appearing in blue can be controlled, while values in black can not be changed. Red values are unavailable.

space_JMX_13_IMG993.gif

Operations Tab

The space Operations tab allows you to perform different space operations:

Operation Description
getSpace returns the space proxy that this manageable bean governs.
getStatistics returns a StatisticsContext according to the operation code you type in the operationCode text box – each operation has a constant representing it.
clean cleans the selected space.
count when entering a specific class name in the className textbox, displays the number of Entries in this class.
clear when entering a specific class name in the className textbox, removes the Entries that match this template from the space.
stop attempts to stop the selected space.
start attempts to start the selected space.
ping checks whether the space is alive and accessible.
restart restarts the space.
getClusterPolicy displays a cluster policy instance.
getRuntimeInfo returns a RuntimeInfo instance.
getURL displays the spaceURL instance which was used to initialize the space.

space_JMX_14_IMG997.gif

Info Tab

The space Info tab displays the MBean name and its Java class.

space_JMX_15_IMG998.gif

Space MBean Extension

The Space MBean Extension exposes advanced space attributes – this includes memory management, persistency and communication settings.

Attributes Tab

The space extensions Attributes tab displays a list of advanced space attributes/elements by XPath, in the selected space. Attribute values appearing in blue can be controlled, while values in black can not be changed. Red values are unavailable.

See also:
For details on specific configuration file elements, refer to the Configuration Files Element List*** section.

space_JMX_16_IMG999.gif

Info Tab

The space extensions Info tab displays the MBean name and its Java class.

space_JMX_17_IMG200.gif

Restricting and Modifying MBeans

There is an option to restrict the access to space and space container operations or attributes; for example, you can decide to hide some of the attributes and configuration, and disable execution of operations.

This way, you can view, restrict or modify most of the space and space container configuration (as set in the space/container schema files), or the basic admin operations, which were discussed in the above sections.

To do this, modify the following space and space container MBean Descriptors, which are located inside the <XAP Root>\lib\required\xap-datagrid.jar file:

  • ContainerMBeanDescriptors.xml
  • JavaSpaceExtMBeanDescriptors.xml
  • JavaSpaceMBeanDescriptors.xml

Settings to Modify

Following are some space/space container MBeans Attributes settings you can modify:

  • Attribute – required, otherwise is optional.
  • name – the name of the attribute.
  • type - The type or class name of the attribute.
  • description – a description of the attribute.
  • isReadable – true if the attribute has a getter method, false otherwise.
  • isWritable – true if the attribute has a setter method, false otherwise.

Following are some space/space container MBeans Operations settings you can modify:

  • Operation – required, otherwise optional.
  • name – the name of the method.
  • type – the type of the method’s return value.
  • impact – the impact of the method, one of INFO, ACTION, ACTION_INFO, UNKNOWN.
  • description – a description of the operation.
  • signatureMBeanParameterInfo objects describing the parameters (arguments) of the method.
  • Signature – the list of parameters info.
    • Parameter – required, otherwise optional.
    • name – the name of the data.
    • type - the type or class name of the data.