package de.gernd.simplemon.service;

import de.gernd.simplemon.config.MonitoringConfig;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

/**
 * Implements the simple website monitoring functionality
 */
@Component
public class SimpleMonitoringService implements InitializingBean {

    private final Logger log = Logger.getLogger(SimpleMonitoringService.class);

    private final MonitoringData monitoringData = new MonitoringData();

    /**
     * number of threads available for the monitoring task
     */
    private final int NUMBER_OF_THREADS = 1;

    @Autowired
    private MonitoringConfig monitoringConfig;

    private final ScheduledExecutorService executorService = Executors.newScheduledThreadPool(NUMBER_OF_THREADS);

    /**
     * Start monitoring a website
     *
     * @param url URL of the website to monitor
     */
    public synchronized void startMonitoring(String url) {
        log.info("Request to start monitoring " + url);
        monitoringData.addUrl(url);
    }

    public List<MonitoredUrl> getMonitoredSites() {
        return monitoringData.getMonitoredUrls();
    }

    public List<MonitoringResult> getMonitoringResults(final int id) {
        return monitoringData.getMonitoringResults(id);
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        executorService.scheduleAtFixedRate(new ScheduledMonitoringJob(monitoringData),
                monitoringConfig.getInterval(),
                monitoringConfig.getInterval(), TimeUnit.SECONDS);
    }
}

@@ -81,16 +81,50 @@
 Config;%0A
+import lombok.extern.slf4j.Slf4j;%0A
 import o
@@ -551,16 +551,23 @@
 mponent%0A
+@Slf4j%0A
 public c
@@ -630,89 +630,8 @@
  %7B%0A%0A
-    private final Logger log = Logger.getLogger(SimpleMonitoringService.class);%0A%0A
     

Use lombok annotation for logger