当前位置:网站首页>Distributed solution - Comprehensive decryption of distributed task scheduling platform -xxljob
Distributed solution - Comprehensive decryption of distributed task scheduling platform -xxljob
2022-07-05 12:32:00 【vx-Yang_ Gaige】
What is a scheduled task
Assign a time to perform the task
Java The way to achieve scheduled tasks
Thread
public class Demo01 {
static long count = 0;
public static void main(String[] args) {
Runnable runnable = new Runnable() {
@Override
public void run() {
while (true) {
try {
Thread.sleep(1000);
count++;
System.out.println(count);
} catch (Exception e) {
// TODO: handle exception
}
}
}
};
Thread thread = new Thread(runnable);
thread.start();
}
}
TimerTask
/**
* Use TimerTask Class to implement timed tasks
*/
public class Demo02 {
static long count = 0;
public static void main(String[] args) {
TimerTask timerTask = new TimerTask() {
@Override
public void run() {
count++;
System.out.println(co
边栏推荐
- ZABBIX agent2 monitors mongodb nodes, clusters and templates (official blog)
- Learn the memory management of JVM 03 - Method area and meta space of JVM
- ZABBIX agent2 monitors mongodb templates and configuration operations
- Semantic segmentation experiment: UNET network /msrc2 dataset
- Learn JVM garbage collection 05 - root node enumeration, security points, and security zones (hotspot)
- Master the new features of fluent 2.10
- Understanding the architecture type of mobile CPU
- Swift - enables textview to be highly adaptive
- Time tools
- End to end neural network
猜你喜欢
Flutter2 heavy release supports web and desktop applications
Resnet18 actual battle Baoke dream spirit
Course design of compilation principle --- formula calculator (a simple calculator with interface developed based on QT)
How can beginners learn flutter efficiently?
[superhard core] is the core technology of redis
Take you two minutes to quickly master the route and navigation of flutter
How to clear floating?
Linux Installation and deployment lamp (apache+mysql+php)
Why do you always fail in automated tests?
Redis's memory elimination mechanism, read this article is enough.
随机推荐
The evolution of mobile cross platform technology
Basic operations of MySQL data table, addition, deletion and modification & DML
Solution to order timeout unpaid
Swift - enables textview to be highly adaptive
Select drop-down box realizes three-level linkage of provinces and cities in China
Anaconda creates a virtual environment and installs pytorch
How does MySQL execute an SQL statement?
Four operations and derivative operations of MATLAB polynomials
Interviewer: is acid fully guaranteed for redis transactions?
ZABBIX customized monitoring disk IO performance
ZABBIX monitors mongodb (template and deployment operations)
Codeforces Round #804 (Div. 2)
Introduction to GNN
Why do you always fail in automated tests?
Master the new features of fluent 2.10
Correct opening method of redis distributed lock
MVVM framework part I lifecycle
Learn garbage collection 01 of JVM -- garbage collection for the first time and life and death judgment
IPv6与IPv4的区别 网信办等三部推进IPv6规模部署
[superhard core] is the core technology of redis