This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch camel-2.20.x
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-2.20.x by this push:
new 7e7c6ea Close file watcher when stopping.
7e7c6ea is described below
commit 7e7c6ea30281106ca1b1e3dcd006988f2a192ea4
Author: Claus Ibsen <[email protected]>
AuthorDate: Tue Jun 5 14:09:39 2018 +0200
Close file watcher when stopping.
---
.../main/java/org/apache/camel/impl/FileWatcherReloadStrategy.java | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git
a/camel-core/src/main/java/org/apache/camel/impl/FileWatcherReloadStrategy.java
b/camel-core/src/main/java/org/apache/camel/impl/FileWatcherReloadStrategy.java
index b908054..4b23d5f 100644
---
a/camel-core/src/main/java/org/apache/camel/impl/FileWatcherReloadStrategy.java
+++
b/camel-core/src/main/java/org/apache/camel/impl/FileWatcherReloadStrategy.java
@@ -56,6 +56,7 @@ public class FileWatcherReloadStrategy extends
ReloadStrategySupport {
private String folder;
private boolean isRecursive;
+ private WatchService watcher;
private ExecutorService executorService;
private WatchFileChangesTask task;
private Map<WatchKey, Path> folderKeys;
@@ -143,7 +144,7 @@ public class FileWatcherReloadStrategy extends
ReloadStrategySupport {
try {
Path path = dir.toPath();
- WatchService watcher = path.getFileSystem().newWatchService();
+ watcher = path.getFileSystem().newWatchService();
// we cannot support deleting files as we don't know which
routes that would be
if (isRecursive) {
this.folderKeys = new HashMap<WatchKey, Path>();
@@ -191,6 +192,10 @@ public class FileWatcherReloadStrategy extends
ReloadStrategySupport {
getCamelContext().getExecutorServiceManager().shutdownGraceful(executorService);
executorService = null;
}
+
+ if (watcher != null) {
+ IOHelper.close(watcher);
+ }
}
/**
--
To stop receiving notification emails like this one, please contact
[email protected].