Skip to content

Commit

Permalink
Include full exception when WatchQueueReader thread dies (openhab#2538)
Browse files Browse the repository at this point in the history
See openhab#2537

Signed-off-by: Cody Cutrer <cody@cutrer.us>
  • Loading branch information
ccutrer authored Jan 18, 2022
1 parent b6bac8d commit 57ed7ef
Showing 1 changed file with 8 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -203,15 +203,10 @@ public synchronized void stopWatchService(AbstractWatchService service) {

@Override
public void run() {
try {
for (;;) {
while (!Thread.currentThread().isInterrupted()) {
try {
WatchKey key;
try {
key = watchService.take();
} catch (InterruptedException exc) {
logger.info("Caught InterruptedException: {}", exc.getLocalizedMessage());
return;
}
key = watchService.take();

for (WatchEvent<?> event : key.pollEvents()) {
WatchEvent.Kind<?> kind = event.kind();
Expand Down Expand Up @@ -273,11 +268,12 @@ public void run() {
}

key.reset();
} catch (InterruptedException exc) {
logger.debug("WatchQueueReader interrupted; thread exiting: {}", exc.getLocalizedMessage());
return;
} catch (Exception exc) {
logger.debug("Exception caught in WatchQueueReader", exc);
}
} catch (Exception exc) {
logger.debug("ClosedWatchServiceException caught! {}. \n{} Stopping ", exc.getLocalizedMessage(),
Thread.currentThread().getName());
return;
}
}

Expand Down

0 comments on commit 57ed7ef

Please sign in to comment.