当前位置:网站首页>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 ,
边栏推荐
猜你喜欢
Why do many people misunderstand technical debt
When knative meets webassembly
全链路压测:影子库与影子表之争
Operand of null-aware operation ‘!‘ has type ‘SchedulerBinding‘ which excludes null.
Operand of null-aware operation ‘!‘ has type ‘SchedulerBinding‘ which excludes null.
qt 简单布局 盒子模型 加弹簧
Function pointer and pointer function in C language
基于Bevy游戏引擎和FPGA的双人游戏
Ansible报错:“msg“: “Invalid/incorrect password: Permission denied, please try again.“
y58.第三章 Kubernetes从入门到精通 -- 持续集成与部署(三一)
随机推荐
U++4 interface learning notes
线程池的创建与使用
Talk about the importance of making it clear
Using thread class and runnable interface to realize the difference between multithreading
Error: No named parameter with the name ‘foregroundColor‘
批量归一化(标准化)处理
The sooner you understand the four rules of life, the more blessed you will be
When knative meets webassembly
Appium practice | make the test faster, more stable and more reliable (I): slice test
2039: [蓝桥杯2022初赛] 李白打酒加强版 (动态规划)
记录一次压测经验总结
Mysql database (basic)
如何设计 API 接口,实现统一格式返回?
IMS data channel concept of 5g vonr+
If you‘re running pod install manually, make sure flutter pub get is executed first.
SQL injection - secondary injection and multi statement injection
JS 的 try catch finally 中 return 的执行顺序
Analysis -- MySQL statement execution process & MySQL architecture
sublime使用技巧
Full link voltage test: the dispute between shadow database and shadow table