public void setPlugins(List newPlugins) { if (plugins != null) { throw new IllegalStateException("Unable to set a list of plugins after plugins exists."); } for (int i = 0; i < newPlugins.size(); i++) { EtmPlugin plugin = (EtmPlugin) newPlugins.get(i); addPlugin(plugin); } }
/** * Creates a EtmMonitorSupport instance. * * @param aDescription The description for this monitor. * @param aTimer The timer to use. * @param aAggregator The aggregator to use. */ protected EtmMonitorSupport(String aDescription, ExecutionTimer aTimer, Aggregator aAggregator) { description = aDescription; if (aTimer != null) { timer = aTimer; } else { timer = EtmMonitorFactory.bestAvailableTimer(); } if (aAggregator != null) { aggregator = aAggregator; } else { aggregator = getDefaultAggregator(); } startTime = new Date(); lastReset = startTime; }
protected void startPlugins() { if (plugins != null) { for (int i = 0; i < plugins.size(); i++) { EtmPlugin etmPlugin = (EtmPlugin) plugins.get(i); startPlugin(etmPlugin); } } }
public final void visitPreMeasurement(MeasurementPoint measurementPoint) { try { if (!collecting) { return; } if (!started) { if (!noStartedErrorMessageFlag) { showMonitorNotStartedMessage(); } return; } if (measurementPoint == null) { return; } doVisitPreMeasurement(measurementPoint); measurementPoint.setTicks(timer.getTicksPerSecond()); measurementPoint.setStartTime(timer.getCurrentTime()); // catch all exceptions here // in order to avoid negative side effects for // our business logic } catch (Exception e) { log.warn("Caught exception within measurement code. ", e); } }
public void collect() { if (name == null) { throw new IllegalStateException("A measurement point may not be collected without a proper name."); } monitor.visitPostCollect(this); }
public final EtmMonitorMetaData getMetaData() { List pluginMetaData = getPluginMetaData(); return new EtmMonitorMetaData( getClass(), description, startTime, lastReset, aggregator.getMetaData(), timer.getMetaData(), pluginMetaData); }
public void stop() { LOG.info("Shutting down JETM."); if (!started) { collecting = false; return; } collecting = false; started = false; scheduler.cancel(); aggregator.stop(); shutdownPlugins(); dispatcher.deregister(this); }
public final void visitPostCollect(MeasurementPoint measurementPoint) { if (!collecting || !started) { return; } if (measurementPoint == null) { return; } try { measurementPoint.setEndTime(timer.getCurrentTime()); doVisitPostCollect(measurementPoint); aggregator.add(measurementPoint); // catch all exceptions here // in order to avoid negative side effects for // our business logic } catch (Exception e) { log.warn("Caught exception within measurement code.", e); } }
public void start() { if (started) { collecting = true; return; } scheduler = new Timer(true); if (dispatcher == null) { dispatcher = new DefaultEventDispatcher(); } dispatcher.register(this); // 1. start plugins startPlugins(); // 2. init aggregators aggregator.init(new EtmMonitorSupportContext(this, scheduler)); // 3. start aggregators aggregator.start(); started = true; collecting = true; log.info("JETM " + Version.getVersion() + " started."); }
public final void visitPreMeasurement(MeasurementPoint measurementPoint) { try { if (!collecting) { return; } if (!started) { if (!noStartedErrorMessageFlag) { showMonitorNotStartedMessage(); } return; } if (measurementPoint == null) { return; } doVisitPreMeasurement(measurementPoint); measurementPoint.setTicks(timer.getTicksPerSecond()); measurementPoint.setStartTime(timer.getCurrentTime()); // catch all exceptions here // in order to avoid negative side effects for // our business logic } catch (Exception e) { LOG.warn("Caught exception within measurement code. ", e); } }
public void collect() { if (name == null) { throw new IllegalStateException("A measurement point may not be collected without a proper name."); } monitor.visitPostCollect(this); }
public final EtmMonitorMetaData getMetaData() { List pluginMetaData = getPluginMetaData(); return new EtmMonitorMetaData( getClass(), description, startTime, lastReset, aggregator.getMetaData(), timer.getMetaData(), pluginMetaData); }
public void stop() { log.info("Shutting down JETM."); if (!started) { collecting = false; return; } collecting = false; started = false; scheduler.cancel(); aggregator.stop(); shutdownPlugins(); dispatcher.deregister(this); }
public final void visitPostCollect(MeasurementPoint measurementPoint) { if (!collecting || !started) { return; } if (measurementPoint == null || measurementPoint.isCollected()) { return; } try { measurementPoint.setEndTime(timer.getCurrentTime()); doVisitPostCollect(measurementPoint); aggregator.add(measurementPoint); // catch all exceptions here // in order to avoid negative side effects for // our business logic } catch (Exception e) { LOG.warn("Caught exception within measurement code.", e); } }
public void start() { if (started) { collecting = true; return; } scheduler = new Timer(true); if (dispatcher == null) { dispatcher = new DefaultEventDispatcher(); } dispatcher.register(this); // 1. start plugins startPlugins(); // 2. init aggregators aggregator.init(new EtmMonitorSupportContext(this, scheduler)); // 3. start aggregators aggregator.start(); started = true; collecting = true; LOG.info("JETM " + Version.getVersion() + " started."); }
public void setPlugins(List newPlugins) { if (plugins != null) { throw new IllegalStateException("Unable to set a list of plugins after plugins exists."); } for (int i = 0; i < newPlugins.size(); i++) { EtmPlugin plugin = (EtmPlugin) newPlugins.get(i); addPlugin(plugin); } }
public void addPlugin(EtmPlugin aEtmPlugin) { if (plugins == null) { plugins = new ArrayList(); } plugins.add(aEtmPlugin); if (started) { startPlugin(aEtmPlugin); } }
/** * Creates a EtmMonitorSupport instance. * * @param aDescription The description for this monitor. * @param aTimer The timer to use. * @param aAggregator The aggregator to use. */ protected EtmMonitorSupport(String aDescription, ExecutionTimer aTimer, Aggregator aAggregator) { description = aDescription; if (aTimer != null) { timer = aTimer; } else { timer = EtmMonitorFactory.bestAvailableTimer(); } if (aAggregator != null) { aggregator = aAggregator; } else { aggregator = getDefaultAggregator(); } startTime = new Date(); lastReset = startTime; }