This sample shows how to use the Kodo JMX Management technology preview.
In order to see an example of remote management:
Open two console windows, and ensure in each that your CLASSPATH has all of the jars distributed with Kodo, and that your execution path is configured for the Kodo tools. If you need additional help with this step, see the installation directions at Chapter 2, SolarMetric Kodo JDO Installation.
In the first console window, ensure that the Kodo distribution root directory is in your CLASSPATH
Ensure that an appropriate kodo.properties is in a directory in your CLASSPATH or in the root level of a jar in your CLASSPATH
Change to the samples/management directory
Compile the class file by running: javac *.java
Enhance the data classes by running: jdoc package.jdo
Update the database schema and generate a mapping file by running: mappingtool -action refresh package.jdo
Seed the database by running: java samples.management.SeedDatabase
Add the following line to your kodo.properties file:
kodo.ManagementConfiguration: mx4j1-remote-mgmt
Start the sample program by running: java samples.management.ManagementSampleRemote
Within a few seconds, go to the second console window, and run: remotejmxtool After the SolarMetric JMX Viewer comes up, click on the first JMX button. Accept the connection defaults. You can now view the management statistics.
The Kodo ProfilingAgent also has a JMX MBean. You can see an example of remote profiling if you turn on the ProfilingAgent by making the following setting in your kodo.properties file:
kodo.ManagementConfiguration: mx4j1-remote-mgmt-prof
The Kodo ProfilingAgent also has a local mode. You can see an example of local profiling if you turn on the ProfilingAgent by making the following setting in your kodo.properties file:
kodo.ManagementConfiguration: profiling-gui
A fetch group g has been pre-configured in the package.jdo file. You can turn on the usage of that fetch group in the example by adding the following setting to your kodo.properties file:
kodo.FetchGroups: g
Note that the Kodo PersistenceManagerFactory DataCache also has a JMX MBean. You can see an example of DataCache management if you turn on the data cache by adding the following settings to your kodo.properties file:
kodo.DataCache: true
kodo.RemoteCommitProvider: sjvm
An example of how to use the TimeWatch can be found in QueryThread.java. A TimeWatch allows for monitoring of named code blocks.