mirror of
https://github.com/Dark98/SliceBeam.git
synced 2026-07-03 00:38:53 +00:00
Optimize boot time
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
package ru.ytkab0bp.slicebeam.boot;
|
||||
|
||||
import com.instacart.library.truetime.TrueTime;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class TrueTimeTask extends BootTask {
|
||||
/** @noinspection BusyWait*/
|
||||
public TrueTimeTask() {
|
||||
super(() -> {
|
||||
while (true) {
|
||||
try {
|
||||
TrueTime.build().withNtpHost("0.ru.pool.ntp.org").initialize();
|
||||
break;
|
||||
} catch (IOException ignore) {
|
||||
try {
|
||||
Thread.sleep(100);
|
||||
} catch (InterruptedException ignored) {}
|
||||
}
|
||||
}
|
||||
});
|
||||
onWorker();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user