logger.info("Reading configuration ...");
Config config = readConfig(configPath);
logger.info("Validating configuration ...");
validateConfig(config);
FolderWatcher watcher = new FolderWatcher(config);
/*
* start the watcher
*/
watcher.start();
/*
* run as long we have no shutdown file
*/
try {
while (!shutdownFileExists()) {
try {
Thread.sleep(TimeUnit.SECONDS.toMillis(20));
} catch (InterruptedException e) {
/*
* ignore and continue
*/
}
}
} finally {
logger.info("Shutting down");
/*
* stop the watcher and end
*/
watcher.stop();
logger.info("Done");
}
}