Skip to content

Commit

Permalink
Merge pull request #96 from hkupty/improve-tests
Browse files Browse the repository at this point in the history
refactor: Use virtual threads for file watcher
  • Loading branch information
hkupty authored Mar 23, 2024
2 parents 4fe7ceb + d547f35 commit 2babc3e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ the PATCH component is omitted when its value is `0`.
#### Changed

- Restructure configuration; implement new interface([#89](https://github.com/hkupty/penna/pull/89))
- Use Virtual Thread for the File watcher([#96](https://github.com/hkupty/penna/pull/96))

## 0.7.2

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public boolean register(Manager manager) {
}

private void startWorker() {
var worker = new Thread(() -> {
Thread.ofVirtual().name("penna-yaml-config-file-watcher").start(() -> {
try (WatchService watchService = FileSystems.getDefault().newWatchService()) {
var target = configPath.getFileName();
configPath.getParent().register(watchService, StandardWatchEventKinds.ENTRY_MODIFY);
Expand All @@ -81,8 +81,6 @@ private void startWorker() {
}
} catch (Exception ignored) {}
});
worker.setDaemon(true);
worker.start();
}

/**
Expand Down

0 comments on commit 2babc3e

Please sign in to comment.