From 8bf6b2c62c814c5d8e160bc41a5a0089e4a4c9d9 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Fri, 17 Oct 2014 14:29:40 +1100 Subject: [PATCH] 444031 Ensure exceptions do not reduce threadpool below minimum improved the suppression of warnings --- .../eclipse/jetty/util/thread/QueuedThreadPool.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/thread/QueuedThreadPool.java b/jetty-util/src/main/java/org/eclipse/jetty/util/thread/QueuedThreadPool.java index ff18e93eaea..375aa0d3ce3 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/thread/QueuedThreadPool.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/thread/QueuedThreadPool.java @@ -522,6 +522,7 @@ public class QueuedThreadPool extends AbstractLifeCycle implements SizedThreadPo public void run() { boolean shrink = false; + boolean ignore = false; try { Runnable job = _jobs.poll(); @@ -538,7 +539,10 @@ public class QueuedThreadPool extends AbstractLifeCycle implements SizedThreadPo { runJob(job); if (Thread.interrupted()) + { + ignore=true; break loop; + } job = _jobs.poll(); } @@ -575,12 +579,15 @@ public class QueuedThreadPool extends AbstractLifeCycle implements SizedThreadPo finally { if (_threadsIdle.decrementAndGet() == 0) + { startThreads(1); + } } } } catch (InterruptedException e) { + ignore=true; LOG.ignore(e); } catch (Throwable e) @@ -591,7 +598,8 @@ public class QueuedThreadPool extends AbstractLifeCycle implements SizedThreadPo { if (!shrink && isRunning()) { - LOG.warn("Unexpected thread death: {} in {}",this,QueuedThreadPool.this); + if (!ignore) + LOG.warn("Unexpected thread death: {} in {}",this,QueuedThreadPool.this); // This is an unexpected thread death! if (_threadsStarted.decrementAndGet()