当前位置:网站首页>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(); }
边栏推荐
- Opengauss database development and debugging tool guide
- 左连接,内连接
- Find the storage address of the elements in the two-dimensional array
- labelimg生成的xml文件转换为voc格式
- Model transformation onnx2engine
- PAT乙级“1104 天长地久”DFS优化思路
- I2C 子系统(三):I2C Driver
- C#通用接口调用
- Last update time of all sqlserver tables
- From C to capable -- use the pointer as a function parameter to find out whether the string is a palindrome character
猜你喜欢
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
docker安装redis
MySql實戰45講【SQL查詢和更新執行流程】
Opengauss database development and debugging tool guide
MySql实战45讲【行锁】
敏捷认证(Professional Scrum Master)模拟练习题-2
[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
Pytest (6) -fixture (Firmware)
I2C 子系统(四):I2C debug
Use of El tree search method
随机推荐
MySQL practice 45 [SQL query and update execution process]
Vs 2019 configuration du moteur de génération de tensorrt
QT based tensorrt accelerated yolov5
How to return ordered keys after counter counts the quantity
后管中编辑与预览获取表单的值写法
C # general interface call
What happens between entering the URL and displaying the page?
Find the storage address of the elements in the two-dimensional array
Update and return document in mongodb - update and return document in mongodb
[principles of multithreading and high concurrency: 1_cpu multi-level cache model]
Agile certification (professional scrum Master) simulation exercises
一文带你了解 ZigBee
VS 2019配置tensorRT
Parameter index out of range (1 > number of parameters, which is 0)
Serious security vulnerabilities reported by moxa mxview network management software
MySql实战45讲【行锁】
Add automatic model generation function to hade
Joking about Domain Driven Design (III) -- Dilemma
Docker install MySQL
MySql实战45讲【事务隔离】