diff options
author | Greg Wilkins | 2013-10-21 04:12:07 +0000 |
---|---|---|
committer | Greg Wilkins | 2013-10-21 04:12:07 +0000 |
commit | bb7ab62c7a5ef83a8f4edcfa35b1b829970d7103 (patch) | |
tree | 817bf7f09550c9fcec27781dcd97a67745ec46cb /jetty-util | |
parent | 972af9a21988b37a3d0ef0f60bd5540665ea2d25 (diff) | |
download | org.eclipse.jetty.project-bb7ab62c7a5ef83a8f4edcfa35b1b829970d7103.tar.gz org.eclipse.jetty.project-bb7ab62c7a5ef83a8f4edcfa35b1b829970d7103.tar.xz org.eclipse.jetty.project-bb7ab62c7a5ef83a8f4edcfa35b1b829970d7103.zip |
419914 - QueuedThreadPool uses nanoTime
Diffstat (limited to 'jetty-util')
-rw-r--r-- | jetty-util/src/main/java/org/eclipse/jetty/util/thread/QueuedThreadPool.java | 12 |
1 files changed, 6 insertions, 6 deletions
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 c116739f49..f765f4e701 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 @@ -129,10 +129,10 @@ public class QueuedThreadPool extends AbstractLifeCycle implements SizedThreadPo jobs.offer(noop); // try to jobs complete naturally for half our stop time - long stopby = System.currentTimeMillis() + timeout / 2; + long stopby = System.nanoTime() + TimeUnit.MILLISECONDS.toNanos(timeout) / 2; for (Thread thread : _threads) { - long canwait = stopby - System.currentTimeMillis(); + long canwait = TimeUnit.NANOSECONDS.toMillis(stopby - System.nanoTime()); if (canwait > 0) thread.join(canwait); } @@ -145,10 +145,10 @@ public class QueuedThreadPool extends AbstractLifeCycle implements SizedThreadPo thread.interrupt(); // wait again for the other half of our stop time - stopby = System.currentTimeMillis() + timeout / 2; + stopby = System.nanoTime() + TimeUnit.MILLISECONDS.toNanos(timeout) / 2; for (Thread thread : _threads) { - long canwait = stopby - System.currentTimeMillis(); + long canwait = TimeUnit.NANOSECONDS.toMillis(stopby - System.nanoTime()); if (canwait > 0) thread.join(canwait); } @@ -549,8 +549,8 @@ public class QueuedThreadPool extends AbstractLifeCycle implements SizedThreadPo if (size > _minThreads) { long last = _lastShrink.get(); - long now = System.currentTimeMillis(); - if (last == 0 || (now - last) > _idleTimeout) + long now = System.nanoTime(); + if (last == 0 || (now - last) > TimeUnit.MILLISECONDS.toNanos(_idleTimeout)) { shrink = _lastShrink.compareAndSet(last, now) && _threadsStarted.compareAndSet(size, size - 1); |