当前位置:网站首页>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();
}
边栏推荐
- I2C 子系統(四):I2C debug
- C#通用接口调用
- JMeter performance test JDBC request (query database to obtain database data) use "suggestions collection"
- I2C 子系统(一):I2C spec
- I2C 子系统(四):I2C debug
- open file in 'w' mode: IOError: [Errno 2] No such file or directory
- From C to capable -- use the pointer as a function parameter to find out whether the string is a palindrome character
- 从输入URL到页面展示这中间发生了什么?
- Opengauss database development and debugging tool guide
- 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
猜你喜欢

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

Kubernetes cluster log and efk architecture log scheme

Le processus de connexion mysql avec docker

I2C subsystem (I): I2C spec

Deep reinforcement learning for intelligent transportation systems: a survey paper reading notes

Vs 2019 configure tensorrt to generate engine

Pytorch配置

别再用 System.currentTimeMillis() 统计耗时了,太 Low,StopWatch 好用到爆!

I2C 子系統(四):I2C debug

Privatization lightweight continuous integration deployment scheme -- 01 environment configuration (Part 2)
随机推荐
左连接,内连接
Are there any recommended term life insurance products? I want to buy a term life insurance.
Super easy to use logzero
The idea cannot be loaded, and the market solution can be applied (pro test)
ComponentScan和ComponentScans的区别
Tensorflow to pytorch notes; tf. gather_ Nd (x, y) to pytorch
Introduction to cron expression
你真的懂继电器吗?
基于QT的tensorRT加速的yolov5
MySql实战45讲【全局锁和表锁】
Serious security vulnerabilities reported by moxa mxview network management software
[shutter] monitor the transparency gradient of the scrolling action control component (remove the blank of the top status bar | frame layout component | transparency component | monitor the scrolling
Use cve-2021-43893 to delete files on the domain controller
3D drawing example
MySql實戰45講【SQL查詢和更新執行流程】
基于Qt的yolov5工程
敏捷认证(Professional Scrum Master)模拟练习题
Concrete CMS vulnerability
I2C subsystem (IV): I2C debug
Source code analysis | layout file loading process