/** * Sets all properties of the {@link MonitoringEngine} that have been configured, such as * {@link #getMonitoringEnabled()} and {@link #getInheritableStrategy()}, then starts it. After * the {@link MonitoringEngine} is started, schedules all {@link #getTimerTasks() timer tasks}. */ public void startup() { MonitoringEngine.getInstance().setMonitoringEnabled(monitoringEnabled); MonitoringEngine.getInstance().setProcessorFactory(factory); MonitoringEngine.getInstance().setDecomposer(decomposer); MonitoringEngine.getInstance().setInheritableStrategy(inheritableStrategy); MonitoringEngine.getInstance().setStartupRunnable(startupRunnable); if (timerTasks == null) { timerTasks = Collections.emptyMap(); } MonitoringEngine.getInstance().startup(); EventMonitor monitor = new EventMonitor("MonitoringEngineManager.lifecycle", MonitoringLevel.ESSENTIAL); monitor.set("eventType", "startup"); monitor.fire(); scheduledExecutor = Executors.newSingleThreadScheduledExecutor(); for (Entry<Integer, Collection<TimerTask>> entry : timerTasks.entrySet()) { long millis = entry.getKey(); for (Runnable task : entry.getValue()) { scheduledExecutor.scheduleAtFixedRate(task, millis, millis, TimeUnit.MILLISECONDS); } } }