-
-
Notifications
You must be signed in to change notification settings - Fork 299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Code quality - drop while(true) #526
base: master
Are you sure you want to change the base?
Changes from 2 commits
185c63c
fc1ed78
800084d
303e45c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -95,6 +95,8 @@ private void watchPathChanges() { | |
reCreateWatchService(); | ||
} | ||
|
||
// This should keep running to keep track of files changes | ||
// Must be implemented as an active check due to the way Java handles listening to file changes | ||
while (true) { | ||
|
||
if (Objects.isNull(watcher)) { | ||
|
@@ -118,6 +120,7 @@ private void watchPathChanges() { | |
} | ||
|
||
List<WatchEvent<?>> watchEvents = watchKey.pollEvents(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. pollEvents is not blocking, might want to add a sleep somewhere in here or use a self-scheduling method instead of a loop |
||
watchKey.reset(); | ||
|
||
boolean updateFsView = false; | ||
for (WatchEvent<?> event : watchEvents) { | ||
|
@@ -137,14 +140,9 @@ private void watchPathChanges() { | |
} | ||
} | ||
} | ||
watchKey.reset(); | ||
} else if (kind == ENTRY_MODIFY && event.count() > 1) { | ||
watchKey.reset(); | ||
} else { | ||
} else if (kind != ENTRY_MODIFY || (kind == ENTRY_MODIFY && event.count() == 0)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FIXME: should be |
||
updateFsView = true; | ||
watchKey.reset(); | ||
} | ||
|
||
} | ||
|
||
if (updateFsView) { | ||
|
@@ -159,7 +157,6 @@ private void watchPathChanges() { | |
} | ||
fileBrowseService.refreshPathToTree(path, changedPath); | ||
} | ||
|
||
} | ||
|
||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this should be replaced by