Skip to content

Commit

Permalink
Merge pull request #11626 from mikemccand/thread_pool_nano_time
Browse files Browse the repository at this point in the history
Use System.nanoTime for ThreadPool's estimated time, since it's less likely to go backwards
  • Loading branch information
Michael McCandless committed Jun 12, 2015
2 parents 4e94d09 + f152614 commit 8e85304
Showing 1 changed file with 2 additions and 2 deletions.
Expand Up @@ -564,7 +564,7 @@ static class EstimatedTimeThread extends Thread {
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);
}
Expand All @@ -576,7 +576,7 @@ public long estimatedTimeInMillis() {
@Override
public void run() {
while (running) {
estimatedTimeInMillis = System.currentTimeMillis();
estimatedTimeInMillis = TimeValue.nsecToMSec(System.nanoTime());
try {
Thread.sleep(interval);
} catch (InterruptedException e) {
Expand Down

0 comments on commit 8e85304

Please sign in to comment.