Java technology includes support for managing and monitoring applications, objects and devices. JVM COBOL provides a managed bean (MBean) that enables you to manage and monitor RunUnits.
You can enable a RunUnit MBean in one of the following ways:
Using the RunUnit class to enable the RunUnit MBean for a particular RunUnit level:
A constructor on the RunUnit includes a RunUnitStartupOptions enum with a new value called UseManagementBean. The following illustrates how you can use the RunUnitStartupOptions enum with its UseManagementBean option:
RunUnit myRUBean = new RunUnit("MyApplication", RunUnitStartupOptions.UseManagementBean) try { myRUBean.add(new PROGRAM1()); // Where PROGRAM1 is the COBOL program } finally { myRUBean.stopRun(); }
Using a cobconfig.properties text file to enable the MBean for all RunUnits you create:
mbeans=true
There are different programs such as Oracle's Java Mission Control or JConsole that enable you to view and use MBeans.
Before you can use the MBean with some versions of JRE, you need to enable your application for dynamic attachment. To do this, execute the following command from the Java command line:
-Dcom.sun.management.jmxremote
An MBean provides the following two attributes that enable a visual indication of how many RunUnits are live:
If the values of LiveRunUnitCount and LogicalRunUnitCount differ, it could indicate one of the following issues:
The following figure shows an example of how the Java Mission Control tool displays a leak:
You can use the MBean operation dumpAllLongRunningRunUnitInfo to identify RunUnits that have been running for a specific period of time. The MBean operation takes a long parameter for the time in milliseconds.
In Oracle's Java Mission Control application, you can find this on the Operations tab for com.microfocus.runtimeservices and in the MBean Tree section - see the figure below.
The information returned from the MBean enables you to see the name, id, start time, GUID and a stack trace of where the RunUnit was created.
The oldest RunUnit is always the RunUnit with an id of 1 and this is the initial or default RunUnit.
If you create and use the RunUnit in the same method, Micro Focus recommends that you release the MBean in the finally clause - for example:
RunUnit myRUBean = new RunUnit("MyApplication", RunUnitStartupOptions.UseManagementBean) try { ... use the myRUBean object } finally { myRUBean.stopRun(); }
For more information, see: