Sun Java System Application Server Enterprise Edition 8.1 2005Q2 Developer's Guide

Setting Monitoring States

The setMonitoring() method demonstrates how to set monitoring states.

Example 16–7 Setting Monitoring States

private static final Set LEGAL_MON =
    Collections.unmodifiableSet( SampleUtil.newSet( new String[]
} ));
public void setMonitoring(
    final String configName,
    final String state )
    if ( ! LEGAL_MON.contains( state ) )
        throw new IllegalArgumentException( state );
    final ConfigConfig config =
        getConfigConfigMap().get( configName );
    final ModuleMonitoringLevelsConfig mon =
    mon.setConnectorConnectionPool( state );
    mon.setThreadPool( state );
    mon.setHTTPService( state );
    mon.setJDBCConnectionPool( state );
    mon.setORB( state );
    mon.setTransactionService( state );
    mon.setWebContainer( state );
    mon.setEJBContainer( state );

The AMX API defines three levels of monitoring in, namely, HIGH, LOW, and OFF.

In this example, the configuration element being monitored is named configName. The interface is used to configure the config element for configName in the domain.xml file.

An instance of is created to configure the module-monitoring-levels element for configName in the domain.xml file.

The ModuleMonitoringLevelsConfig instance created then calls each of its set methods to change their states to state.

The above is performed by running the set-monitoring command when you run SimpleMain, stating the name of the configuration element to be monitored and the monitoring state to one of HIGH, LOW or OFF.