You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2019/02/21 16:52:28 UTC

[sling-ide-tooling] branch feature/SLING-7605 updated: SLING-8287 - DirWatcherTest consistently fails on Jenkins

This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch feature/SLING-7605
in repository https://gitbox.apache.org/repos/asf/sling-ide-tooling.git


The following commit(s) were added to refs/heads/feature/SLING-7605 by this push:
     new 3b0bcae  SLING-8287 -  DirWatcherTest consistently fails on Jenkins
3b0bcae is described below

commit 3b0bcaec167c2eff5383fb2b9bd983543a8e4431
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Thu Feb 21 17:51:53 2019 +0100

    SLING-8287 -  DirWatcherTest consistently fails on Jenkins
    
    There is a race condition when shutting down the DirWatcher, as when the
    poller thread is interrupted and then the watch service is closed the
    polling may be running and the interrupt may be acted on too late.
    
    Treat this as a regular occurence and simply stop polling.
---
 cli/cli/src/main/java/org/apache/sling/ide/cli/impl/DirWatcher.java | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/cli/cli/src/main/java/org/apache/sling/ide/cli/impl/DirWatcher.java b/cli/cli/src/main/java/org/apache/sling/ide/cli/impl/DirWatcher.java
index 8eb9795..3286445 100644
--- a/cli/cli/src/main/java/org/apache/sling/ide/cli/impl/DirWatcher.java
+++ b/cli/cli/src/main/java/org/apache/sling/ide/cli/impl/DirWatcher.java
@@ -21,6 +21,7 @@ import static java.nio.file.StandardWatchEventKinds.ENTRY_DELETE;
 import static java.nio.file.StandardWatchEventKinds.ENTRY_MODIFY;
 
 import java.io.IOException;
+import java.nio.file.ClosedWatchServiceException;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.StandardWatchEventKinds;
@@ -61,6 +62,8 @@ public class DirWatcher implements AutoCloseable {
                 } catch ( InterruptedException e) {
                     Thread.currentThread().interrupt();
                     break;
+                } catch ( ClosedWatchServiceException e) {
+                    break;
                 }
             }
         }, getClass().getSimpleName() +"-Poller");