mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-08 22:14:59 +00:00
use System.nanoTime for ThreadPool's estimated time, since it's less likely to go backwards
This commit is contained in:
parent
5bb6f5d6ac
commit
f152614f92
@ -564,7 +564,7 @@ public class ThreadPool extends AbstractComponent {
|
|||||||
EstimatedTimeThread(String name, long interval) {
|
EstimatedTimeThread(String name, long interval) {
|
||||||
super(name);
|
super(name);
|
||||||
this.interval = interval;
|
this.interval = interval;
|
||||||
this.estimatedTimeInMillis = System.currentTimeMillis();
|
this.estimatedTimeInMillis = TimeValue.nsecToMSec(System.nanoTime());
|
||||||
this.counter = new TimeCounter();
|
this.counter = new TimeCounter();
|
||||||
setDaemon(true);
|
setDaemon(true);
|
||||||
}
|
}
|
||||||
@ -576,7 +576,7 @@ public class ThreadPool extends AbstractComponent {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
while (running) {
|
while (running) {
|
||||||
estimatedTimeInMillis = System.currentTimeMillis();
|
estimatedTimeInMillis = TimeValue.nsecToMSec(System.nanoTime());
|
||||||
try {
|
try {
|
||||||
Thread.sleep(interval);
|
Thread.sleep(interval);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user