当前位置:网站首页>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(); }
边栏推荐
- Are there any recommended term life insurance products? I want to buy a term life insurance.
- Idea set method call ignore case
- yii2 中andWhere多个or查询 orm条件
- MySQL practice 45 [global lock and table lock]
- C#通用接口调用
- [C language] MD5 encryption for account password
- Super easy to use logzero
- ASP. Net core 6 framework unveiling example demonstration [02]: application development based on routing, MVC and grpc
- Add some hard dishes to the interview: how to improve throughput and timeliness in delayed task scenarios!
- 当lambda没有输入时,是何含义?
猜你喜欢
分布式事务
迅雷chrome扩展插件造成服务器返回的数据js解析页面数据异常
Docker install MySQL
内存泄漏工具VLD安装及使用
The process of connecting MySQL with docker
Kubernetes cluster log and efk architecture log scheme
Agile certification (professional scrum Master) simulation exercise-2
MySql实战45讲【行锁】
Privatization lightweight continuous integration deployment scheme -- 01 environment configuration (Part 2)
Anhui University | small target tracking: large-scale data sets and baselines
随机推荐
Three. JS local environment setup
I2C 子系统(二):I3C spec
BigVision代码
Chart. JS multitooltip tag - chart js multiTooltip labels
L'index des paramètres d'erreur est sorti de la plage pour les requêtes floues (1 > Nombre de paramètres, qui est 0)
Super easy to use logzero
Unity3d human skin real time rendering real simulated human skin real time rendering "suggestions collection"
How do you adjust the scope of activerecord Association in rails 3- How do you scope ActiveRecord associations in Rails 3?
I2C 子系统(一):I2C spec
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
别再用 System.currentTimeMillis() 统计耗时了,太 Low,StopWatch 好用到爆!
com.fasterxml.jackson.databind.exc.InvalidFormatException问题
[error record] the parameter 'can't have a value of' null 'because of its type, but the im
PHP constructor with parameters - PHP constructor with a parameter
Add automatic model generation function to hade
MySql实战45讲【事务隔离】
How to implement append in tensor
MySql實戰45講【SQL查詢和更新執行流程】
docker安装redis
Nasvit: neural architecture search of efficient visual converter with gradient conflict perception hypernetwork training