Skip to content

Commit

Permalink
🎨 Refactor import statements and improve code formatting in Directory…
Browse files Browse the repository at this point in the history
…Watcher
  • Loading branch information
mkjsix committed Nov 21, 2024
1 parent 639e919 commit fc59bd2
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions commons/src/main/java/org/restheart/utils/DirectoryWatcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@
*/
package org.restheart.utils;

import static java.nio.file.StandardWatchEventKinds.ENTRY_CREATE;
import static java.nio.file.StandardWatchEventKinds.ENTRY_DELETE;
import static java.nio.file.StandardWatchEventKinds.ENTRY_MODIFY;

import java.io.IOException;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;
import static java.nio.file.StandardWatchEventKinds.ENTRY_CREATE;
import static java.nio.file.StandardWatchEventKinds.ENTRY_DELETE;
import static java.nio.file.StandardWatchEventKinds.ENTRY_MODIFY;
import java.nio.file.WatchEvent;
import java.nio.file.WatchEvent.Kind;
import java.nio.file.WatchKey;
Expand Down Expand Up @@ -82,7 +83,7 @@ public void run() {
WatchKey key;

try {
key = watchService.take(); // This will block until an event occurs
key = watchService.take(); // This will block until an event occurs
} catch (InterruptedException e) {
return;
}
Expand Down Expand Up @@ -112,10 +113,10 @@ public void run() {
LambdaUtils.throwsSneakyException(e);
}
this.onEvent.accept(child, ENTRY_CREATE);
} else if (kind.equals(ENTRY_MODIFY) && Files.isRegularFile(child)) {
} else if (kind.equals(ENTRY_MODIFY) && Files.isRegularFile(child)) {
LOGGER.debug("File modified: {}", child);
this.onEvent.accept(child, ENTRY_MODIFY);
} else if (kind.equals(ENTRY_DELETE)) {
} else if (kind.equals(ENTRY_DELETE)) {
LOGGER.debug("File or directory deleted: {}", child);
this.onEvent.accept(child, ENTRY_DELETE);

Expand Down

0 comments on commit fc59bd2

Please sign in to comment.