当前位置:网站首页>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边栏推荐
- Redis's memory elimination mechanism, read this article is enough.
- 强化学习-学习笔记3 | 策略学习
- Understanding the architecture type of mobile CPU
- ZABBIX ODBC database monitoring
- Redis highly available sentinel cluster
- MySQL installation, Windows version
- Design of music box based on assembly language
- C language structure is initialized as a function parameter
- Instance + source code = see through 128 traps
- Why learn harmonyos and how to get started quickly?
猜你喜欢

Summary of C language learning problems (VS)

Pytorch two-layer loop to realize the segmentation of large pictures

Flutter2 heavy release supports web and desktop applications

Seven ways to achieve vertical centering

Reinforcement learning - learning notes 3 | strategic learning

Understand kotlin from the perspective of an architect

C language structure is initialized as a function parameter

Making and using the cutting tool of TTF font library
Automated test lifecycle

强化学习-学习笔记3 | 策略学习
随机推荐
GPS data format conversion [easy to understand]
Intern position selection and simplified career development planning in Internet companies
Constructing expression binary tree with prefix expression
Learning items
SENT协议译码的深入探讨
Correct opening method of redis distributed lock
What is the difference between canvas and SVG?
End to end neural network
July Huaqing learning-1
Codeforces Round #804 (Div. 2)
Conversion du format de données GPS [facile à comprendre]
Is investment and finance suitable for girls? What financial products can girls buy?
嵌入式软件架构设计-消息交互
ZABBIX agent2 monitors mongodb templates and configuration operations
ZABBIX monitors mongodb (template and deployment operations)
GPS數據格式轉換[通俗易懂]
[hdu 2096] Xiaoming a+b
Just a coincidence? The mysterious technology of apple ios16 is actually the same as that of Chinese enterprises five years ago!
Master-slave mode of redis cluster
GPS数据格式转换[通俗易懂]