throw new IllegalArgumentException("config is null");
List<MeasurableCapability> measurables = new ArrayList<MeasurableCapability>();
/* Create the Memory MeasurableCapability. This will measure memory
* for the JVM */
MeasurableCapability memory = new Memory(config);
if(memory.isEnabled())
measurables.add(memory);
/* If SIGAR is available, create a Memory MeasurableCapability for the
* physical machine as well */
boolean haveSigar = SigarHelper.sigarAvailable();
if(haveSigar) {
MeasurableCapability systemMemory = new SystemMemory(config);
if(systemMemory.isEnabled())
measurables.add(systemMemory);
}
/* Load memory pool management */
try {
MeasurableCapability[] pools =
(MeasurableCapability[])config.getEntry(COMPONENT+".memory.pool",
"memoryPools",
MeasurableCapability[].class,
null,
config);
if(pools!=null)
measurables.addAll(Arrays.asList(pools));
} catch(ConfigurationException e) {
logger.warn("Loading CPU MeasurableCapability", e);
}
/* Create the CPU MeasurableCapability */
MeasurableCapability cpu = new CPU(config);
if(cpu.isEnabled())
measurables.add(cpu);
MeasurableCapability jvmCpu = new CPU(config, SystemWatchID.PROC_CPU, true);
if(jvmCpu.isEnabled())
measurables.add(jvmCpu);
/*
* Load the DiskSpace capability only if we have SIGAR or if SIGAR is
* not available and not running on Windows
*/
MeasurableCapability diskSpace = null;
if(haveSigar) {
diskSpace = getDiskSpace(config);
} else if(!OperatingSystemType.isWindows()) {
diskSpace = getDiskSpace(config);
}
if(diskSpace!=null && diskSpace.isEnabled())
measurables.add(diskSpace);
/*
* Load any additional MeasurableCapability instances that have been
* configured