Merge branch '1.5.x'
This commit is contained in:
@@ -182,22 +182,23 @@ public class FileSystemWatcher {
|
|||||||
* @param remainingScans the number of remaining scans
|
* @param remainingScans the number of remaining scans
|
||||||
*/
|
*/
|
||||||
void stopAfter(int remainingScans) {
|
void stopAfter(int remainingScans) {
|
||||||
|
Thread thread = null;
|
||||||
synchronized (this.monitor) {
|
synchronized (this.monitor) {
|
||||||
Thread thread = this.watchThread;
|
thread = this.watchThread;
|
||||||
if (thread != null) {
|
if (thread != null) {
|
||||||
this.remainingScans.set(remainingScans);
|
this.remainingScans.set(remainingScans);
|
||||||
if (remainingScans <= 0) {
|
if (remainingScans <= 0) {
|
||||||
thread.interrupt();
|
thread.interrupt();
|
||||||
}
|
}
|
||||||
if (Thread.currentThread() != thread) {
|
}
|
||||||
try {
|
this.watchThread = null;
|
||||||
thread.join();
|
}
|
||||||
}
|
if (Thread.currentThread() != thread) {
|
||||||
catch (InterruptedException ex) {
|
try {
|
||||||
Thread.currentThread().interrupt();
|
thread.join();
|
||||||
}
|
}
|
||||||
}
|
catch (InterruptedException ex) {
|
||||||
this.watchThread = null;
|
Thread.currentThread().interrupt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user