Skip to content

Commit

Permalink
perf(Exception): capture NoSuchFileException if the dir is wrong
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnymillergh committed Oct 20, 2020
1 parent 05ec18b commit bd7c695
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,14 @@ public class Bootstrap implements CommandLineRunner {
public void afterInitialization() {
log.debug("Bootstrap initialization is done. Start to process videos.");
log.debug("Starting FileWatcher...");
FileWatcher fileWatcher = new FileWatcher(mediaStreamingProperties.getVideoDirectoryOnFileSystem());
FileWatcher fileWatcher;
try {
fileWatcher = new FileWatcher(mediaStreamingProperties.getVideoDirectoryOnFileSystem());
} catch (Exception e) {
log.error("Cannot build FileWatcher, file observation failed! " +
"Check `media-streaming.videoDirectoryOnFileSystem` configuration.", e);
return;
}
fileWatcher.setFileWatcherHandler(new FileWatcherHandler() {
@Override
public void onCreated(Path file) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import java.nio.file.WatchService;

/**
* Description: SingletonWatchService, change description here.
* Description: WatchServiceSingleton, change description here.
*
* @author Johnny Miller (锺俊), email: [email protected], date: 10/20/2020 4:52 PM
**/
Expand Down

0 comments on commit bd7c695

Please sign in to comment.