Merge pull request #11626 from mikemccand/thread_pool_nano_time

Use System.nanoTime for ThreadPool's estimated time, since it's less likely to go backwards
This commit is contained in:
Michael McCandless 2015-06-12 10:09:55 -04:00
commit 8e85304af3
1 changed files with 2 additions and 2 deletions

View File

@ -564,7 +564,7 @@ public class ThreadPool extends AbstractComponent {
EstimatedTimeThread(String name, long interval) {
super(name);
this.interval = interval;
this.estimatedTimeInMillis = System.currentTimeMillis();
this.estimatedTimeInMillis = TimeValue.nsecToMSec(System.nanoTime());
this.counter = new TimeCounter();
setDaemon(true);
}
@ -576,7 +576,7 @@ public class ThreadPool extends AbstractComponent {
@Override
public void run() {
while (running) {
estimatedTimeInMillis = System.currentTimeMillis();
estimatedTimeInMillis = TimeValue.nsecToMSec(System.nanoTime());
try {
Thread.sleep(interval);
} catch (InterruptedException e) {