Commit 4e87f816 authored by Andy Wilkinson's avatar Andy Wilkinson

Merge branch '1.5.x'

parents fd478be5 71c15cb6
......@@ -182,22 +182,23 @@ public class FileSystemWatcher {
* @param remainingScans the number of remaining scans
*/
void stopAfter(int remainingScans) {
Thread thread = null;
synchronized (this.monitor) {
Thread thread = this.watchThread;
thread = this.watchThread;
if (thread != null) {
this.remainingScans.set(remainingScans);
if (remainingScans <= 0) {
thread.interrupt();
}
if (Thread.currentThread() != thread) {
try {
thread.join();
}
catch (InterruptedException ex) {
Thread.currentThread().interrupt();
}
}
this.watchThread = null;
}
this.watchThread = null;
}
if (Thread.currentThread() != thread) {
try {
thread.join();
}
catch (InterruptedException ex) {
Thread.currentThread().interrupt();
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment