Trabajar con estadísticas de recursos en una aplicación CMP

Inicie, detenga y revise el estado de la recopilación de estadísticas de recursos en sus aplicaciones CMP.

Antes de empezar:
Puede crear aplicaciones CMP para examinar y controlar la recopilación de estadísticas de recursos.
Comprobación de que los tipos de recurso pueden devolver estadísticas
///////////////////////////////////////////////////////	
// Sample CMP API code that connects to a local broker
// called 'testbrk' and writes out available
// resource types on the broker that have the 
// ability to emit resource-level statistics. 
BrokerProxy b = null;
try {
    b = BrokerProxy.getLocalInstance("testbrk");
	String[] resourceNames = b.getResourceTypeNames();
	for (String thisResource : resourceNames) {
		System.out.println(thisResource);
	}
} catch (ConfigManagerProxyLoggedException e) {
	e.printStackTrace();
} catch (ConfigManagerProxyPropertyNotInitializedException e) {
	e.printStackTrace();
}
Comprobación de los nombres de recursos asociados a un tipo de recurso específico
///////////////////////////////////////////////////////	
// Sample CMP API code that connects to a local broker
// called 'testbrk' and writes out resource property
// names reported for a specific resource type.
BrokerProxy b = null;
try {
    b = BrokerProxy.getLocalInstance("testbrk");
	String[] resourcePropertyNames = 
				b.getResourceTypeStatisticsPropertyNames("JVM");
	for (String thisResourceProperty : resourcePropertyNames) {
		System.out.println(thisResourceProperty);
	}
} catch (ConfigManagerProxyLoggedException e) {
	e.printStackTrace();
} catch (ConfigManagerProxyPropertyNotInitializedException e) {
	e.printStackTrace();
}
Inicio de la recopilación de estadísticas
///////////////////////////////////////////////////////	
// Sample CMP API code that connects to a local broker
// called 'testbrk' and gets a reference to the execution
// group called 'default'. It then enables resource 
// statistics for all the execution group's resource types.
BrokerProxy b = null;
try {
    b = BrokerProxy.getLocalInstance("testbrk");
	ExecutionGroupProxy eg = b.getExecutionGroupByName("default");
	if (eg != null) {
		eg.setResourceStatisticsEnabled(null, true);
	}
} catch (ConfigManagerProxyLoggedException e) {
	e.printStackTrace();
} catch (ConfigManagerProxyPropertyNotInitializedException e) {
	e.printStackTrace();
}
Detención de la recopilación de estadísticas
///////////////////////////////////////////////////////	
// Sample CMP API code that connects to a local broker
// called 'testbrk' and gets a reference to the execution
// group called 'default'. It then disables resource 
// statistics for all the execution group's resource types.
BrokerProxy b = null;
try {
    b = BrokerProxy.getLocalInstance("testbrk");
	ExecutionGroupProxy eg = b.getExecutionGroupByName("default");
	if (eg != null) {
		eg.setResourceStatisticsEnabled(null, false);
	}
} catch (ConfigManagerProxyLoggedException e) {
	e.printStackTrace();
} catch (ConfigManagerProxyPropertyNotInitializedException e) {
	e.printStackTrace();
}
Visualización del estado de la recopilación de estadísticas
///////////////////////////////////////////////////////	
// Sample CMP API code that connects to a local broker
// called 'testbrk' and gets a reference to the execution
// group called 'default'. It then writes out if resource 
// statistics is enabled.
BrokerProxy b = null;
try {
    b = BrokerProxy.getLocalInstance("testbrk");
	ExecutionGroupProxy eg = b.getExecutionGroupByName("default");
	if (eg != null) {
		System.out.println(eg.getResourceStatisticsEnabled(null));
	}
} catch (ConfigManagerProxyLoggedException e) {
	e.printStackTrace();
} catch (ConfigManagerProxyPropertyNotInitializedException e) {
	e.printStackTrace();
}
Avisos | Marcas registradas | Descargas | Biblioteca | Soporte | Su opinión

Copyright IBM Corporation 1999, 2013Copyright IBM Corporation 1999, 2013.

        
        Última actualización
        
        Última actualización : 2013-02-27 18:27:26


Tema de tareaTema de tarea | Versión 8.0.0.2 | be43390_