GitHub user anthonyraymond opened a pull request:
https://github.com/apache/commons-io/pull/36
FileAlternationMonitor#stop() not stop the thread
The thread if FileAlterationMonitor wasn't stopped by the `stop(int)`
method, which forbid application to shutdown unless all `Thread` are exited (if
FileAlterationMonitor is part of a DI managed component).
This behavior conflict with the method javadoc `@param stopInterval the
amount of time in milliseconds to wait for the thread to finish.`
### Simple exemple to understand
```java
Thread t = new Thread(() -> {
try {
Thread.sleep(500000);
} catch (final InterruptedException e) {
}
});
t.start();
t.join(50);
// Ok, we reach this point until 500000ms are elapsed, but the thread is
still alive.
// because Thread#join(int) does not kill the thread. And the thread
remains alive.
```
```java
Thread t = new Thread(() -> {
try {
Thread.sleep(500000);
} catch (final InterruptedException e) {
}
});
t.start();
t.join(50);
t.interupt();
// Thread is exited
```
In this case, we waited the given time BEFORE exiting the `Thread`, as
described in the javadoc, and the `Thread` is now finished and killed.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/anthonyraymond/commons-io master
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/commons-io/pull/36.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #36
----
commit bf499227edba4932735477fe8826c9b4d81591d4
Author: anthonyraymond <[email protected]>
Date: 2017-05-01T23:20:25Z
FileAlternationMonitor#stop() kill himsleft instead of letting the thread
running
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]