Broker 10.5 | webMethods Broker Documentation | webMethods Broker Administration Java API Programmer’s Guide | Managing Brokers and Broker Servers | Managing a Broker Server Configuration | Getting System Usage Statistics
 
Getting System Usage Statistics
The BrokerServerClient.getUsageStats method allows you to obtain system usage statistics for the host to which your BrokerServerClient is connected.
After you have obtained the BrokerEvent containing the statistics, you can retrieve each field using the BrokerEvent.get<type>Field method. The version of the get<type>Field method to be used will depend on the data type of the field you are retrieving. The following example illustrates how to obtain a BrokerEvent containing the system usage statistics and extract the value of two fields.
. . .
long swap_space_total;
long swap_space_free;
BrokerEvent e;
BrokerServerClient c;
try {
/* Create a Broker Server client */
c = new BrokerServerClient(broker_host, null);
 
/* Get the BrokerEvent containing the usage statistics */
e = c.getUsageStats();
/* Get the total amount of swap space */
swap_space_total = e.getLongField( "swapSpaceMax");
/* Get the swap space available */
swap_space_free = e.getLongField( "swapSpaceFree");
. . .
} catch (BrokerException ex) {
System.out.println("Error getting usage statistics\n"+ex);
return;
}
. . .