@Override @Transactional public synchronized void startAlertScheduling() { requireNotDisposed(); if (_alertSchedulingThread != null && _alertSchedulingThread.isAlive()) { _logger.info("Request to start alert scheduling aborted as it is already running."); } else { _logger.info("Starting alert scheduling thread."); _alertSchedulingThread = new SchedulingThread("schedule-alerts", LockType.ALERT_SCHEDULING); _alertSchedulingThread.start(); _logger.info("Alert scheduling thread started."); } }
@Override public synchronized void stopAlertScheduling() { requireNotDisposed(); if (_alertSchedulingThread != null && _alertSchedulingThread.isAlive()) { _logger.info("Stopping alert scheduling"); _alertSchedulingThread.interrupt(); _logger.info("Alert scheduling thread interrupted."); try { _logger.info("Waiting for alert scheduling thread to terminate."); _alertSchedulingThread.join(); } catch (InterruptedException ex) { _logger.warn("Alert job scheduler was interrupted while shutting down."); } _logger.info("Alert job scheduling stopped."); } else { _logger.info("Requested shutdown of alert scheduling aborted as it is not yet running."); } }