Connect to a stand-alone catalog service MBean server:
The following example program connects to a stand-alone catalog service MBean server and returns
an XML formatted string that lists each container server along with its allocated shards for a given
ObjectGrid and MapSet.
A few notes regarding the sample program:
The JMXServiceURL value for the catalog service is always of the following
form: service:jmx:rmi:///jndi/rmi://<host>:<port>/objectgrid/MBeanServer, where
<host> is the host on which the catalog service is running and <port> is the
JMX service port that is provided with the -JMXServicePort option when starting
the catalog service. If no port is specified, the default is 1099.
For the ObjectGrid or map statistics to be enabled, you must specify the following property in
the server properties file when you are starting an ObjectGrid container:
statsSpec=all=enabled
To disable the MBeans that are running in the container servers, specify the following property
in the server properties file: enableMBeans=false.
An example of the output follows. This output indicates that two container servers are active.
The Container-0 container server hosts four primary shards. The
Container-1 container server hosts a synchronous replica for each of the
primary shards on the Container-0 container server. In this configuration,
two synchronous replicas and one asynchronous replica are configured. As a result, the
Unassigned container server is left with the remaining shards. If two more container
servers are started, the Unassigned container server is not
displayed.
Container servers host MBeans to query information about the individual maps and ObjectGrid
instances that are running within the container server. The following example program prints the
status of each container server that is hosted by the catalog server with the JMX address of
localhost:1099:
The example program prints out the container server status for each container.
An example of the output follows:
Connect to a catalog service MBean server that is hosted in WebSphere Application Server:
The method for programmatically accessing MBeans in WebSphere Application Server
is slightly different from accessing MBeans in a stand-alone configuration.
Create and compile a Java program to connect to the MBean server.
This
command assumes that the was_root/bin/setupCmdLine.sh script has been run to set the variables properly. An
example of the format of the java.naming.provider.url property value is
corbaloc:iiop:1.0@<host>:<port>/NameService.
Connect to a catalog service MBean server with security enabled:
For more examples on how to display statistics and perform administrative operations with
MBeans, see the xsadmin sample application. You can look at the source code of
the xsadmin sample application in the wxs_home/samples/xsadmin.jar file in a stand-alone installation, or in the wxs_home/xsadmin.jar file in a WebSphere Application Server installation. See Sample: xsadmin utility for more
information about the operations you can complete with the xsAdmin sample
application.