Skip to content

Commit 7643648

Browse files
author
Niall Pemberton
committed
IO-259 - simplify stop(long) method - just use Thread.join(long)
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/io/trunk@1080934 13f79535-47bb-0310-9956-ffa450edef68
1 parent 0582d2e commit 7643648

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

src/main/java/org/apache/commons/io/monitor/FileAlterationMonitor.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,7 @@ public synchronized void stop() throws Exception {
154154
* Stop monitoring.
155155
*
156156
* @param stopInterval the amount of time in milliseconds to wait for the thread to finish.
157-
* A value of zero will wait until the thread is finished (see {@link Thread#join(long)})
158-
* and a negative value will stop the process immediately).
157+
* A value of zero will wait until the thread is finished (see {@link Thread#join(long)}).
159158
* @throws Exception if an error occurs initializing the observer
160159
* @since Commons IO 2.1
161160
*/
@@ -165,11 +164,7 @@ public synchronized void stop(long stopInterval) throws Exception {
165164
}
166165
running = false;
167166
try {
168-
if (stopInterval < 0) {
169-
thread.interrupt();
170-
} else {
171-
thread.join(stopInterval);
172-
}
167+
thread.join(stopInterval);
173168
} catch (InterruptedException e) {
174169
Thread.currentThread().interrupt();
175170
}

0 commit comments

Comments
 (0)