Ensures that interupting the thread will always terminate the run() method
TAPESTRY-230: Ignored interruptedException prevents Janitorthread termination.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/tapestry/branches/branch-3-0@244162 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/src/org/apache/tapestry/util/JanitorThread.java b/framework/src/org/apache/tapestry/util/JanitorThread.java
index 229b765..2967472 100644
--- a/framework/src/org/apache/tapestry/util/JanitorThread.java
+++ b/framework/src/org/apache/tapestry/util/JanitorThread.java
@@ -168,17 +168,15 @@
* successful, or false if the thread was interrupted (and should shut down).
*/
- protected boolean waitForNextPass()
+ protected void waitForNextPass()
{
try
{
sleep(interval);
-
- return true;
}
catch (InterruptedException ex)
{
- return false;
+ interrupt();
}
}
@@ -188,10 +186,9 @@
public void run()
{
- while (true)
+ while (!isInterrupted())
{
- if (!waitForNextPass())
- return;
+ waitForNextPass();
sweep();
}