use of com.axway.ats.common.performance.monitor.PerformanceMonitor in project ats-framework by Axway.
the class AtsSystemMonitoringAgent method resetTheMonitoringAgent.
public void resetTheMonitoringAgent() {
for (PerformanceMonitor monitor : monitors) {
log.info("Deinitializing monitor: " + monitor.getDescription());
try {
monitor.deinit();
} catch (Exception e) {
log.error("Error deinitializing monitor: " + monitor.getDescription(), e);
}
}
this.monitors = new ArrayList<PerformanceMonitor>();
this.pollErrors = new HashMap<String, Integer>();
}
use of com.axway.ats.common.performance.monitor.PerformanceMonitor in project ats-framework by Axway.
the class InternalSystemMonitoringOperations method initializeMonitor.
private void initializeMonitor(String monitorClassName, List<FullReadingBean> readings, int pollInterval) throws MonitorConfigurationException {
// try to make an instance of the monitor class
Object monitorInstance;
try {
monitorInstance = Class.forName(monitorClassName).newInstance();
} catch (InstantiationException e) {
throw new MonitorConfigurationException("InstantiationException while constructing '" + monitorClassName + "' monitor. Exception error message: " + e.getMessage());
} catch (IllegalAccessException e) {
throw new MonitorConfigurationException("IllegalAccessException while constructing '" + monitorClassName + "' monitor. Exception error message: " + e.getMessage());
} catch (ClassNotFoundException e) {
throw new MonitorConfigurationException("ClassNotFoundException while constructing '" + monitorClassName + "' monitor. Exception error message: " + e.getMessage());
}
// check if it implements the needed interface
if (!(monitorInstance instanceof PerformanceMonitor)) {
throw new MonitorConfigurationException(monitorClassName + " is not a valid monitor class");
}
PerformanceMonitor monitor = (PerformanceMonitor) monitorInstance;
try {
// initialize the monitor
monitor.setPollInterval(pollInterval);
monitor.init(readings.toArray(new FullReadingBean[readings.size()]));
} catch (Throwable e) {
throw new MonitorConfigurationException("Error initializing " + monitorClassName + " monitor: " + e.getMessage(), e);
}
monitoringAgent.addMonitor(monitor);
}
use of com.axway.ats.common.performance.monitor.PerformanceMonitor in project ats-framework by Axway.
the class AtsSystemMonitoringAgent method resetTheMonitoringAgent.
public void resetTheMonitoringAgent() {
for (PerformanceMonitor monitor : monitors) {
log.info("Deinitializing monitor: " + monitor.getDescription());
try {
monitor.deinit();
} catch (Exception e) {
log.error("Error deinitializing monitor: " + monitor.getDescription(), e);
}
}
this.monitors = new ArrayList<PerformanceMonitor>();
this.pollErrors = new HashMap<String, Integer>();
synchronized (collectedResults) {
this.collectedResults.clear();
}
}
use of com.axway.ats.common.performance.monitor.PerformanceMonitor in project ats-framework by Axway.
the class AgentSystemMonitor method initializeMonitor.
private void initializeMonitor(String monitorClassName, List<ReadingBean> readings, int pollInterval) throws MonitorConfigurationException {
// try to make an instance of the monitor class
Object monitorInstance;
try {
monitorInstance = Class.forName(monitorClassName).newInstance();
} catch (InstantiationException e) {
throw new MonitorConfigurationException("InstantiationException while constructing '" + monitorClassName + "' monitor. Exception error message: " + e.getMessage());
} catch (IllegalAccessException e) {
throw new MonitorConfigurationException("IllegalAccessException while constructing '" + monitorClassName + "' monitor. Exception error message: " + e.getMessage());
} catch (ClassNotFoundException e) {
throw new MonitorConfigurationException("ClassNotFoundException while constructing '" + monitorClassName + "' monitor. Exception error message: " + e.getMessage());
}
// check if it implements the needed interface
if (!(monitorInstance instanceof PerformanceMonitor)) {
throw new MonitorConfigurationException(monitorClassName + " is not a valid monitor class");
}
PerformanceMonitor monitor = (PerformanceMonitor) monitorInstance;
try {
// initialize the monitor
monitor.setPollInterval(pollInterval);
monitor.init(readings.toArray(new ReadingBean[readings.size()]));
} catch (Throwable e) {
throw new MonitorConfigurationException("Error initializing " + monitorClassName + " monitor: " + e.getMessage(), e);
}
monitoringAgent.addMonitor(monitor);
}
Aggregations