当前位置:网站首页>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();
}
边栏推荐
- Nasvit: neural architecture search of efficient visual converter with gradient conflict perception hypernetwork training
- How to limit the size of the dictionary- How to limit the size of a dictionary?
- 你真的懂继电器吗?
- QT based tensorrt accelerated yolov5
- Privatization lightweight continuous integration deployment scheme -- 01 environment configuration (Part 2)
- MySql实战45讲【行锁】
- I2C subsystem (I): I2C spec
- [Chongqing Guangdong education] cultural and natural heritage reference materials of China University of Geosciences (Wuhan)
- What happens between entering the URL and displaying the page?
- Force freeing memory in PHP
猜你喜欢

PAT乙级“1104 天长地久”DFS优化思路

Thunderbolt Chrome extension caused the data returned by the server JS parsing page data exception

左连接,内连接

Pytest (6) -fixture (Firmware)

力扣------网格中的最小路径代价

The process of connecting MySQL with docker

Le processus de connexion mysql avec docker

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

Left connection, inner connection

Sqlserver row to column pivot
随机推荐
后管中编辑与预览获取表单的值写法
Kubernetes cluster log and efk architecture log scheme
为什么线程崩溃不会导致 JVM 崩溃
Creation and destruction of function stack frame
[Chongqing Guangdong education] cultural and natural heritage reference materials of China University of Geosciences (Wuhan)
How to limit the size of the dictionary- How to limit the size of a dictionary?
Force freeing memory in PHP
【富瀚6630编码存录像,用rtsp服务器及时间戳同步实现vlc观看录像】
用docker 连接mysql的过程
Super easy to use logzero
The solution of "the required function is not supported" in win10 remote desktop connection is to modify the Registry [easy to understand]
Use cve-2021-43893 to delete files on the domain controller
Reset or clear NET MemoryStream - Reset or Clear . NET MemoryStream
Spark on yarn resource optimization ideas notes
TCP 三次握手和四次挥手机制,TCP为什么要三次握手和四次挥手,TCP 连接建立失败处理机制
复选框的使用:全选,全不选,选一部分
MySql实战45讲【索引】
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
左连接,内连接
模糊查询时报错Parameter index out of range (1 > number of parameters, which is 0)