moduleDir.register(watcher, ENTRY_CREATE, ENTRY_DELETE, ENTRY_MODIFY);
LOG.info("Filesystem monitor: Watching module directory " + moduleDir + " for changes.");
for (;;) {
final WatchKey key = watcher.take();
for (WatchEvent<?> event : key.pollEvents()) {
final WatchEvent.Kind<?> kind = event.kind();
if (kind == OVERFLOW) { // An OVERFLOW event can occur regardless of registration if events are lost or discarded.
LOG.warn("Filesystem monitor: filesystem events may have been missed");
continue;