当前位置:网站首页>Réglez la hauteur et lancez le système. Currenttimemillis catton
Réglez la hauteur et lancez le système. Currenttimemillis catton
2022-07-03 03:11:00 【Années d'amitié】
public class SystemClock {
private final int period;
private final AtomicLong now;
private static class InstanceHolder {
private static final SystemClock INSTANCE = new SystemClock(1);
}
private SystemClock(int period) {
this.period = period;
this.now = new AtomicLong(System.currentTimeMillis());
scheduleClockUpdating();
}
private static SystemClock instance() {
return InstanceHolder.INSTANCE;
}
private void scheduleClockUpdating() {
ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor(runnable -> {
Thread thread = new Thread(runnable, "System Clock");
thread.setDaemon(true);
return thread;
});
scheduler.scheduleAtFixedRate(() -> now.set(System.currentTimeMillis()), period, period, TimeUnit.MILLISECONDS);
}
private long currentTimeMillis() {
return now.get();
}
/**
* Pour remplacer l'original System.currentTimeMillis()
*/
public static long now() {
return instance().currentTimeMillis();
}
边栏推荐
- TCP handshake three times and wave four times. Why does TCP need handshake three times and wave four times? TCP connection establishes a failure processing mechanism
- Anhui University | small target tracking: large-scale data sets and baselines
- 敏捷认证(Professional Scrum Master)模拟练习题
- vfork执行时出现Segmentation fault
- 复选框的使用:全选,全不选,选一部分
- The base value is too large (the error is marked as "08") [duplicate] - value too great for base (error token is'08') [duplicate]
- I2C 子系统(一):I2C spec
- Privatization lightweight continuous integration deployment scheme -- 01 environment configuration (Part 2)
- I2C 子系統(四):I2C debug
- Installation and use of memory leak tool VLD
猜你喜欢

Sous - système I2C (IV): débogage I2C

Vs 2019 configuration du moteur de génération de tensorrt

idea 加载不了应用市场解决办法(亲测)

Agile certification (professional scrum Master) simulation exercise-2

从C到Capable-----利用指针作为函数参数求字符串是否为回文字符

Three. JS local environment setup

I2C 子系统(二):I3C spec

MySql实战45讲【SQL查询和更新执行流程】

I2C subsystem (IV): I2C debug

Deep learning: multi-layer perceptron and XOR problem (pytoch Implementation)
随机推荐
Concrete CMS vulnerability
[C language] MD5 encryption for account password
MySQL practice 45 lecture [row lock]
左连接,内连接
Parameter index out of range (1 > number of parameters, which is 0)
What does it mean when lambda is not entered?
tensorflow转pytorch笔记;tf.gather_nd(x,y)转pytorch
Installation and use of memory leak tool VLD
将时间戳转为指定格式的时间
[combinatorics] Application of exponential generating function (multiple set arrangement problem | different balls in different boxes | derivation of exponential generating function of odd / even sequ
Check log4j problems using stain analysis
Andwhere multiple or query ORM conditions in yii2
labelme标记的文件转换为yolov5格式
函数栈帧的创建与销毁
Last update time of all sqlserver tables
Spark on yarn资源优化思路笔记
Do you really understand relays?
VS 2019安装及配置opencv
The process of connecting MySQL with docker
从输入URL到页面展示这中间发生了什么?