* fix watch service problems as far as possible (still might miss some changes for unkown reasons...)

This commit is contained in:
Reinhard Pointner 2012-09-02 05:58:47 +00:00
parent 4fb02fe187
commit 233f4c1aac
1 changed files with 6 additions and 1 deletions

View File

@ -80,7 +80,11 @@ public abstract class FolderWatchService implements Closeable {
final SortedSet<File> files = new TreeSet<File>(); final SortedSet<File> files = new TreeSet<File>();
synchronized (commitSet) { synchronized (commitSet) {
files.addAll(commitSet); for (File it : commitSet) {
if (it.isFile()) {
files.add(it);
}
}
commitSet.clear(); commitSet.clear();
} }
@ -154,6 +158,7 @@ public abstract class FolderWatchService implements Closeable {
// start watching newly created folder // start watching newly created folder
if (watchTree) { if (watchTree) {
try { try {
commitSet.addAll(listFiles(singleton(file), Integer.MAX_VALUE, false));
watchFolder(file); watchFolder(file);
} catch (IOException e) { } catch (IOException e) {
Logger.getLogger(getClass().getName()).log(Level.SEVERE, e.getMessage(), e); Logger.getLogger(getClass().getName()).log(Level.SEVERE, e.getMessage(), e);