当前位置:网站首页>Timer create timer
Timer create timer
2022-07-07 05:14:00 【Yang Asang 815】
import java.util.Timer;
import java.util.TimerTask;
public class TestDamo {
public static void main(String[] args) {
Timer timer=new Timer();// The timer itself is a thread
timer.schedule(new TimerTask() {
@Override
public void run() {
System.out.println(Thread.currentThread()+" Do it once ");
}
},3000,2000);
/*
* Timer A single thread , Process multiple tasks and execute them in sequence , There is a difference between the delay and the time of setting the timer
* Maybe because of one of the exceptions Timer Thread death , Thus affecting subsequent tasks ,
* */
}
}
Timer A single thread , Process multiple tasks and execute them in sequence , There is a difference between the delay and the time of setting the timer
* Maybe because of one of the exceptions Timer Thread death , Thus affecting subsequent tasks ,
边栏推荐
- 《四》表单
- 《五》表格
- Weebly移动端网站编辑器 手机浏览新时代
- Window scheduled tasks
- No experts! Growth secrets for junior and intermediate programmers and "quasi programmers" who are still practicing in Universities
- 记录一次压测经验总结
- Operand of null-aware operation ‘!‘ has type ‘SchedulerBinding‘ which excludes null.
- Auto. JS get all app names of mobile phones
- 2. Overview of securities investment funds
- Mysql database (basic)
猜你喜欢
全链路压测:影子库与影子表之争
01机器学习相关规定
qt 简单布局 盒子模型 加弹簧
Time complexity & space complexity
If you‘re running pod install manually, make sure flutter pub get is executed first.
最长回文子串(动态规划)
Flask project uses flask socketio exception: typeerror: function() argument 1 must be code, not str
Leetcode(46)——全排列
使用知云阅读器翻译统计遗传学书籍
Operand of null-aware operation ‘!‘ has type ‘SchedulerBinding‘ which excludes null.
随机推荐
Knapsack problem (01 knapsack, complete knapsack, dynamic programming)
Stm32f103ze+sht30 detection of ambient temperature and humidity (IIC simulation sequence)
Why is the salary of test and development so high?
高手勿进!写给初中级程序员以及还在大学修炼的“准程序员”的成长秘籍
基于Bevy游戏引擎和FPGA的双人游戏
Leetcode(417)——太平洋大西洋水流问题
NiO related knowledge points (I)
PLC模拟量输出 模拟量输出FB analog2NDA(三菱FX3U)
拿到PMP认证带来什么改变?
批量归一化(标准化)处理
线程池的创建与使用
接口间调用为什么要用json、fastjson怎么赋值的、fastjson [email protected]映射关系问题
[opencv] image morphological operation opencv marks the positions of different connected domains
Ansible报错:“msg“: “Invalid/incorrect password: Permission denied, please try again.“
Development thoughts of adding new requirements in secondary development
Full link voltage test: the dispute between shadow database and shadow table
Clickhouse (03) how to install and deploy Clickhouse
一文搞懂常见的网络I/O模型
装饰器基础学习02
National meteorological data / rainfall distribution data / solar radiation data /npp net primary productivity data / vegetation coverage data