Issue #4096 - allow thread to exit ReservedThreadExecutor on stop

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
Lachlan Roberts 2019-09-19 08:56:01 +10:00
parent 42f1214796
commit 168a95d334
1 changed files with 4 additions and 2 deletions

View File

@ -163,6 +163,9 @@ public class ReservedThreadExecutor extends AbstractLifeCycle implements TryExec
{
if (_lease != null)
_lease.close();
super.doStop();
while (true)
{
ReservedThread thread = _stack.pollFirst();
@ -171,7 +174,6 @@ public class ReservedThreadExecutor extends AbstractLifeCycle implements TryExec
_size.decrementAndGet();
thread.stop();
}
super.doStop();
}
@Override
@ -277,7 +279,7 @@ public class ReservedThreadExecutor extends AbstractLifeCycle implements TryExec
LOG.debug("{} waiting", this);
Runnable task = null;
while (task == null)
while (isRunning() && task == null)
{
boolean idle = false;