Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
tool
/
xxl-job
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 5319b5b8
authored
Mar 31, 2026
by
izhangzhiqing
Committed by
GitHub
Mar 31, 2026
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'master' into master
2 parents
49c32615
80b2df78
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
146 additions
and
70 deletions
doc/XXL-JOB官方文档.md
doc/db/tables_xxl_job.sql
pom.xml
xxl-job-admin/src/main/java/com/xxl/job/admin/controller/biz/JobLogController.java
xxl-job-admin/src/main/java/com/xxl/job/admin/mapper/XxlJobInfoMapper.java
xxl-job-admin/src/main/java/com/xxl/job/admin/scheduler/config/XxlJobAdminBootstrap.java
xxl-job-admin/src/main/java/com/xxl/job/admin/scheduler/thread/JobScheduleHelper.java
xxl-job-admin/src/main/java/com/xxl/job/admin/scheduler/type/strategy/FixRateScheduleType.java
xxl-job-admin/src/main/resources/application.properties
xxl-job-admin/src/main/resources/mapper/XxlJobInfoMapper.xml
xxl-job-admin/src/main/resources/mapper/XxlJobLogMapper.xml
xxl-job-admin/src/main/resources/templates/biz/log.list.ftl
xxl-job-admin/src/test/java/com/xxl/job/admin/mapper/XxlJobInfoMapperTest.java
xxl-job-core/src/main/java/com/xxl/job/core/openapi/AdminBiz.java
xxl-job-executor-samples/xxl-job-executor-sample-springboot-ai/src/main/java/com/xxl/job/executor/controller/IndexController.java
xxl-job-executor-samples/xxl-job-executor-sample-springboot-ai/src/main/java/com/xxl/job/executor/jobhandler/AIXxlJob.java
xxl-job-executor-samples/xxl-job-executor-sample-springboot-ai/src/test/java/com/xxl/job/executor/test/ollama/OllamaTest.java
doc/XXL-JOB官方文档.md
View file @
5319b5b
...
@@ -929,6 +929,9 @@ xxl.job.i18n=zh_CN
...
@@ -929,6 +929,9 @@ xxl.job.i18n=zh_CN
xxl.job.triggerpool.fast.max=300
xxl.job.triggerpool.fast.max=300
xxl.job.triggerpool.slow.max=200
xxl.job.triggerpool.slow.max=200
### 调度触发后,批量更新任务批次数量【必填】
xxl.job.schedule.batchsize=100
### 调度中心日志表数据保存天数 [必填]:过期日志自动清理;限制大于等于7时生效,否则, 如-1,关闭自动清理功能;
### 调度中心日志表数据保存天数 [必填]:过期日志自动清理;限制大于等于7时生效,否则, 如-1,关闭自动清理功能;
xxl.job.logretentiondays=30
xxl.job.logretentiondays=30
```
```
...
@@ -1273,7 +1276,7 @@ public void demoJobHandler() throws Exception {
...
@@ -1273,7 +1276,7 @@ public void demoJobHandler() throws Exception {
{
{
"input": "{输入信息,必填信息}",
"input": "{输入信息,必填信息}",
"prompt": "{模型prompt,可选信息}",
"prompt": "{模型prompt,可选信息}",
"model": "{模型实现,如qwen3
:0.6
b,可选信息}"
"model": "{模型实现,如qwen3
.5:2
b,可选信息}"
}
}
```
```
-
b、difyWorkflowJobHandler:DifyWorkflow 任务,支持自定义inputs、user、baseUrl、apiKey 等输入信息,示例参数如下;
-
b、difyWorkflowJobHandler:DifyWorkflow 任务,支持自定义inputs、user、baseUrl、apiKey 等输入信息,示例参数如下;
...
@@ -2785,10 +2788,15 @@ public void execute() {
...
@@ -2785,10 +2788,15 @@ public void execute() {
- 10、【优化】统一项目依赖管理结构,依赖版本统一到父级pom提升可维护性;
- 10、【优化】统一项目依赖管理结构,依赖版本统一到父级pom提升可维护性;
### 7.44 版本 v3.4.0 Release Notes[ING]
### 7.44 版本 v3.4.0 Release Notes[ING]
-
1、【优化】父POM依赖配置优化,移除容易配置;合并PR-3926;
- 1、【新增】调度性能提升:任务触发后分批批量更新,高频调度场景可百倍降低SQL操作合并执行,提升调度性能;
-
2、【调整】Docker基础镜像调整为eclipse-temurin;
(任务触发后批量更新配置“xxl.job.schedule.batchsize”)
-
3、【TODO】调度触发性能优化:调度触发后任务分批批量更新,提升调度性能;
- 2、【调整】固定频率调度策略调整,修复小概率下触发时间偏差问题;
-
4、【TODO】调度中心OpenAPI完善,提供任务管理能力;封装Agent Skill并推送ClawHub;
- 3、【调整】Docker基础镜像调整为eclipse-temurin;
- 4、【优化】父POM依赖配置优化,移除容易配置;合并PR-3926;
- 5、【升级】升级多项maven依赖至较新版本;
- 6、【优化】调度日志优化:支持执行器维度查看调度日志;新增调度日志索引,提升查询效率;
(数据库新增索引脚本:```
create index I_jobgroup on xxl_job_log (job_group);
```
)
-
7、【TODO】调度中心OpenAPI完善,提供任务管理能力;封装Agent Skill并推送ClawHub;
### TODO LIST
### TODO LIST
...
@@ -2827,11 +2835,10 @@ public void execute() {
...
@@ -2827,11 +2835,10 @@ public void execute() {
-
调度日志:全局配置:废弃; 新增“调度日志策略”:任务维度自定义,保留3天、7天、1个月、3个月、一年、永久;
-
调度日志:全局配置:废弃; 新增“调度日志策略”:任务维度自定义,保留3天、7天、1个月、3个月、一年、永久;
-
执行日志:新增“执行RollingLog开关”:任务维度自定义,支持:RollingLog、普通日志(slf4j输出)、关闭(不输出);
-
执行日志:新增“执行RollingLog开关”:任务维度自定义,支持:RollingLog、普通日志(slf4j输出)、关闭(不输出);
-
21、AccessToken:废弃全局配置;支持在线管理,动态生成、动态启停;
-
21、AccessToken:废弃全局配置;支持在线管理,动态生成、动态启停;
-
22、任务执行后分批批量更新,提升调度性能;
-
22、任务管理OpenAPI;
-
23、任务管理OpenAPI;
-
23、调度中心启动参数线上配置:告警发送邮箱、Token,支持线上配置生效,修改不需重启机器;
-
24、调度中心启动参数线上配置:告警发送邮箱、Token,支持线上配置生效,修改不需重启机器;
-
24、执行器内嵌server切换tomcat,精简依赖;
-
25、执行器内嵌server切换tomcat,精简依赖;
-
25、日志策略新增:
-
26、日志策略新增:
-
调度日志策略:任务级设置,最少保留1天。
-
调度日志策略:任务级设置,最少保留1天。
-
执行日志策略:可选 RollingLog、slf4jLog;
-
执行日志策略:可选 RollingLog、slf4jLog;
-
清理逻辑,性能重构。
-
清理逻辑,性能重构。
...
...
doc/db/tables_xxl_job.sql
View file @
5319b5b
...
@@ -100,8 +100,8 @@ CREATE TABLE `xxl_job_log`
...
@@ -100,8 +100,8 @@ CREATE TABLE `xxl_job_log`
PRIMARY
KEY
(
`id`
),
PRIMARY
KEY
(
`id`
),
KEY
`I_trigger_time`
(
`trigger_time`
),
KEY
`I_trigger_time`
(
`trigger_time`
),
KEY
`I_handle_code`
(
`handle_code`
),
KEY
`I_handle_code`
(
`handle_code`
),
KEY
`I_job
id_jobgroup`
(
`job_id`
,
`job_group`
),
KEY
`I_job
group`
(
`job_group`
),
KEY
`I_job
_
id`
(
`job_id`
)
KEY
`I_jobid`
(
`job_id`
)
)
ENGINE
=
InnoDB
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
;
DEFAULT
CHARSET
=
utf8mb4
;
...
@@ -161,7 +161,7 @@ VALUES (1, 1, '示例任务01', now(), now(), 'XXL', '', 'CRON', '0 0 0 * * ? *'
...
@@ -161,7 +161,7 @@ VALUES (1, 1, '示例任务01', now(), now(), 'XXL', '', 'CRON', '0 0 0 * * ? *'
'DO_NOTHING'
,
'FIRST'
,
'ollamaJobHandler'
,
'{
'DO_NOTHING'
,
'FIRST'
,
'ollamaJobHandler'
,
'{
"input": "慢SQL问题分析思路",
"input": "慢SQL问题分析思路",
"prompt": "你是一个研发工程师,擅长解决技术类问题。",
"prompt": "你是一个研发工程师,擅长解决技术类问题。",
"model": "qwen3
:0.6
b"
"model": "qwen3
.5:2
b"
}'
,
'SERIAL_EXECUTION'
,
0
,
0
,
'BEAN'
,
''
,
'GLUE代码初始化'
,
}'
,
'SERIAL_EXECUTION'
,
0
,
0
,
'BEAN'
,
''
,
'GLUE代码初始化'
,
now
(),
''
),
now
(),
''
),
(
3
,
2
,
'Dify示例任务'
,
now
(),
now
(),
'XXL'
,
''
,
'NONE'
,
''
,
(
3
,
2
,
'Dify示例任务'
,
now
(),
now
(),
'XXL'
,
''
,
'NONE'
,
''
,
...
...
pom.xml
View file @
5319b5b
...
@@ -25,29 +25,29 @@
...
@@ -25,29 +25,29 @@
<maven.compiler.target>
17
</maven.compiler.target>
<maven.compiler.target>
17
</maven.compiler.target>
<maven.test.skip>
true
</maven.test.skip>
<maven.test.skip>
true
</maven.test.skip>
<!-- plugin -->
<!-- plugin -->
<maven-compiler-plugin.version>
3.1
4.1
</maven-compiler-plugin.version>
<maven-compiler-plugin.version>
3.1
5.0
</maven-compiler-plugin.version>
<maven-source-plugin.version>
3.4.0
</maven-source-plugin.version>
<maven-source-plugin.version>
3.4.0
</maven-source-plugin.version>
<maven-javadoc-plugin.version>
3.12.0
</maven-javadoc-plugin.version>
<maven-javadoc-plugin.version>
3.12.0
</maven-javadoc-plugin.version>
<maven-gpg-plugin.version>
3.2.8
</maven-gpg-plugin.version>
<maven-gpg-plugin.version>
3.2.8
</maven-gpg-plugin.version>
<central-publishing-maven-plugin.version>
0.
9
.0
</central-publishing-maven-plugin.version>
<central-publishing-maven-plugin.version>
0.
10
.0
</central-publishing-maven-plugin.version>
<!-- base -->
<!-- base -->
<slf4j-api.version>
2.0.17
</slf4j-api.version>
<slf4j-api.version>
2.0.17
</slf4j-api.version>
<junit-jupiter.version>
6.0.
1
</junit-jupiter.version>
<junit-jupiter.version>
6.0.
3
</junit-jupiter.version>
<!-- jakarta.annotation-api -->
<!-- jakarta.annotation-api -->
<jakarta.annotation-api.version>
3.0.0
</jakarta.annotation-api.version>
<jakarta.annotation-api.version>
3.0.0
</jakarta.annotation-api.version>
<!-- spring -->
<!-- spring -->
<spring-boot.version>
4.0.
1
</spring-boot.version>
<spring-boot.version>
4.0.
5
</spring-boot.version>
<spring.version>
7.0.
2
</spring.version>
<spring.version>
7.0.
6
</spring.version>
<!-- mybatis & db -->
<!-- mybatis & db -->
<mybatis-spring-boot-starter.version>
4.0.1
</mybatis-spring-boot-starter.version>
<mybatis-spring-boot-starter.version>
4.0.1
</mybatis-spring-boot-starter.version>
<mysql-connector-j.version>
9.
5
.0
</mysql-connector-j.version>
<mysql-connector-j.version>
9.
6
.0
</mysql-connector-j.version>
<!-- net -->
<!-- net -->
<netty.version>
4.2.
9
.Final
</netty.version>
<netty.version>
4.2.
12
.Final
</netty.version>
<!-- groovy -->
<!-- groovy -->
<groovy.version>
5.0.
3
</groovy.version>
<groovy.version>
5.0.
4
</groovy.version>
<!-- xxl-sso -->
<!-- xxl-sso -->
<xxl-sso.version>
2.3.2
</xxl-sso.version>
<xxl-sso.version>
2.3.2
</xxl-sso.version>
...
@@ -57,9 +57,9 @@
...
@@ -57,9 +57,9 @@
<gson.version>
2.13.2
</gson.version>
<gson.version>
2.13.2
</gson.version>
<!-- spring-ai -->
<!-- spring-ai -->
<spring-ai.version>
2.0.0-M
1
</spring-ai.version>
<spring-ai.version>
2.0.0-M
4
</spring-ai.version>
<!-- dify -->
<!-- dify -->
<dify-java-client.version>
1.2.
3
</dify-java-client.version>
<dify-java-client.version>
1.2.
5
</dify-java-client.version>
</properties>
</properties>
<dependencyManagement>
<dependencyManagement>
...
...
xxl-job-admin/src/main/java/com/xxl/job/admin/controller/biz/JobLogController.java
View file @
5319b5b
...
@@ -62,6 +62,7 @@ public class JobLogController {
...
@@ -62,6 +62,7 @@ public class JobLogController {
@RequestParam
(
value
=
"jobGroup"
,
required
=
false
,
defaultValue
=
"0"
)
Integer
jobGroup
,
@RequestParam
(
value
=
"jobGroup"
,
required
=
false
,
defaultValue
=
"0"
)
Integer
jobGroup
,
@RequestParam
(
value
=
"jobId"
,
required
=
false
,
defaultValue
=
"0"
)
Integer
jobId
)
{
@RequestParam
(
value
=
"jobId"
,
required
=
false
,
defaultValue
=
"0"
)
Integer
jobId
)
{
// 1、init JobGroupList
// find all jobGroup
// find all jobGroup
List
<
XxlJobGroup
>
jobGroupListTotal
=
xxlJobGroupMapper
.
findAll
();
List
<
XxlJobGroup
>
jobGroupListTotal
=
xxlJobGroupMapper
.
findAll
();
...
@@ -70,44 +71,31 @@ public class JobLogController {
...
@@ -70,44 +71,31 @@ public class JobLogController {
if
(
CollectionTool
.
isEmpty
(
jobGroupList
))
{
if
(
CollectionTool
.
isEmpty
(
jobGroupList
))
{
throw
new
XxlJobException
(
I18nUtil
.
getString
(
"jobgroup_empty"
));
throw
new
XxlJobException
(
I18nUtil
.
getString
(
"jobgroup_empty"
));
}
}
List
<
Integer
>
jobGroupIds
=
jobGroupList
.
stream
().
map
(
XxlJobGroup:
:
getId
).
toList
();
//
parse jobGroup
//
2、check jobId
if
(
jobId
>
0
)
{
if
(
jobId
>
0
)
{
//
assign jobId (+ jobGroup)
//
valid jobId
XxlJobInfo
jobInfo
=
xxlJobInfoMapper
.
loadById
(
jobId
);
XxlJobInfo
jobInfo
=
xxlJobInfoMapper
.
loadById
(
jobId
);
if
(
jobInfo
==
null
)
{
if
(
jobInfo
==
null
)
{
// jobId not exist, inteceptor
throw
new
RuntimeException
(
I18nUtil
.
getString
(
"jobinfo_field_id"
)
+
I18nUtil
.
getString
(
"system_unvalid"
));
throw
new
RuntimeException
(
I18nUtil
.
getString
(
"jobinfo_field_id"
)
+
I18nUtil
.
getString
(
"system_unvalid"
));
}
}
// valid jobGroup
jobGroup
=
jobInfo
.
getJobGroup
();
jobGroup
=
jobInfo
.
getJobGroup
();
}
else
if
(
jobGroup
>
0
)
{
// assign jobGroup
Integer
finalJobGroup
=
jobGroup
;
if
(
CollectionTool
.
isEmpty
(
jobGroupListTotal
.
stream
().
filter
(
item
->
item
.
getId
()
==
finalJobGroup
).
toList
()))
{
// jobGroup not exist, use first
jobGroup
=
jobGroupList
.
get
(
0
).
getId
();
}
}
jobId
=
0
;
}
else
{
// 3、init jobGroup, default first 1
// default first valid jobGroup
if
(!
jobGroupIds
.
contains
(
jobGroup
))
{
jobGroup
=
jobGroupList
.
get
(
0
).
getId
();
jobGroup
=
jobGroupList
.
get
(
0
).
getId
();
jobId
=
0
;
}
}
/*// valid permission
// 4、init jobInfoList
JobGroupPermissionUtil.validJobGroupPermission(request, jobGroup);*/
// find jobList
List
<
XxlJobInfo
>
jobInfoList
=
xxlJobInfoMapper
.
getJobsByGroup
(
jobGroup
);
List
<
XxlJobInfo
>
jobInfoList
=
xxlJobInfoMapper
.
getJobsByGroup
(
jobGroup
);
List
<
Integer
>
jobIds
=
jobInfoList
.
stream
().
map
(
XxlJobInfo:
:
getId
).
toList
();
//
parse jobId
//
5、init JobId, default 0
if
(
CollectionTool
.
isEmpty
(
jobInfoList
))
{
if
(
!
jobIds
.
contains
(
jobId
))
{
jobId
=
0
;
jobId
=
0
;
}
else
{
if
(!
jobInfoList
.
stream
().
map
(
XxlJobInfo:
:
getId
).
toList
().
contains
(
jobId
))
{
// jobId not exist, use first
jobId
=
jobInfoList
.
get
(
0
).
getId
();
}
}
}
// write
// write
...
@@ -133,9 +121,9 @@ public class JobLogController {
...
@@ -133,9 +121,9 @@ public class JobLogController {
JobGroupPermissionUtil
.
validJobGroupPermission
(
request
,
jobGroup
);
JobGroupPermissionUtil
.
validJobGroupPermission
(
request
,
jobGroup
);
// valid jobId
// valid jobId
if
(
jobId
<
1
)
{
/*
if (jobId < 1) {
return Response.ofFail(I18nUtil.getString("system_please_choose") + I18nUtil.getString("jobinfo_job"));
return Response.ofFail(I18nUtil.getString("system_please_choose") + I18nUtil.getString("jobinfo_job"));
}
}
*/
// parse param
// parse param
Date
triggerTimeStart
=
null
;
Date
triggerTimeStart
=
null
;
...
...
xxl-job-admin/src/main/java/com/xxl/job/admin/mapper/XxlJobInfoMapper.java
View file @
5319b5b
...
@@ -61,5 +61,12 @@ public interface XxlJobInfoMapper {
...
@@ -61,5 +61,12 @@ public interface XxlJobInfoMapper {
*/
*/
public
int
scheduleUpdate
(
XxlJobInfo
xxlJobInfo
);
public
int
scheduleUpdate
(
XxlJobInfo
xxlJobInfo
);
/**
* batch update job info
*
* @param jobInfoList
* @return
*/
public
int
scheduleBatchUpdate
(
@Param
(
"list"
)
List
<
XxlJobInfo
>
jobInfoList
);
}
}
xxl-job-admin/src/main/java/com/xxl/job/admin/scheduler/config/XxlJobAdminBootstrap.java
View file @
5319b5b
...
@@ -181,6 +181,9 @@ public class XxlJobAdminBootstrap implements InitializingBean, DisposableBean {
...
@@ -181,6 +181,9 @@ public class XxlJobAdminBootstrap implements InitializingBean, DisposableBean {
@Value
(
"${xxl.job.triggerpool.slow.max}"
)
@Value
(
"${xxl.job.triggerpool.slow.max}"
)
private
int
triggerPoolSlowMax
;
private
int
triggerPoolSlowMax
;
@Value
(
"${xxl.job.schedule.batchsize}"
)
private
int
scheduleBatchSize
;
@Value
(
"${xxl.job.logretentiondays}"
)
@Value
(
"${xxl.job.logretentiondays}"
)
private
int
logretentiondays
;
private
int
logretentiondays
;
...
@@ -244,6 +247,13 @@ public class XxlJobAdminBootstrap implements InitializingBean, DisposableBean {
...
@@ -244,6 +247,13 @@ public class XxlJobAdminBootstrap implements InitializingBean, DisposableBean {
return
triggerPoolSlowMax
;
return
triggerPoolSlowMax
;
}
}
public
int
getScheduleBatchSize
()
{
if
(!(
scheduleBatchSize
>=
50
&&
scheduleBatchSize
<=
500
))
{
return
100
;
}
return
scheduleBatchSize
;
}
public
int
getLogretentiondays
()
{
public
int
getLogretentiondays
()
{
if
(
logretentiondays
<
3
)
{
if
(
logretentiondays
<
3
)
{
return
-
1
;
// Limit greater than or equal to 3, otherwise close
return
-
1
;
// Limit greater than or equal to 3, otherwise close
...
...
xxl-job-admin/src/main/java/com/xxl/job/admin/scheduler/thread/JobScheduleHelper.java
View file @
5319b5b
...
@@ -59,7 +59,7 @@ public class JobScheduleHelper {
...
@@ -59,7 +59,7 @@ public class JobScheduleHelper {
}
}
logger
.
info
(
">>>>>>>>> init xxl-job admin scheduler success."
);
logger
.
info
(
">>>>>>>>> init xxl-job admin scheduler success."
);
// pre-read count: treadpool-size *
trigger-qps (each trigger cost 100ms, qps = 1000/100 = 100
)
// pre-read count: treadpool-size *
10 (trigger-qps: 1000ms / 100ms each trigger cost
)
int
preReadCount
=
(
XxlJobAdminBootstrap
.
getInstance
().
getTriggerPoolFastMax
()
+
XxlJobAdminBootstrap
.
getInstance
().
getTriggerPoolSlowMax
())
*
10
;
int
preReadCount
=
(
XxlJobAdminBootstrap
.
getInstance
().
getTriggerPoolFastMax
()
+
XxlJobAdminBootstrap
.
getInstance
().
getTriggerPoolSlowMax
())
*
10
;
// do schedule
// do schedule
...
@@ -138,8 +138,14 @@ public class JobScheduleHelper {
...
@@ -138,8 +138,14 @@ public class JobScheduleHelper {
}
}
// 3、update trigger info
// 3、update trigger info
for
(
XxlJobInfo
jobInfo:
scheduleList
)
{
/*
for (XxlJobInfo jobInfo: scheduleList) {
XxlJobAdminBootstrap.getInstance().getXxlJobInfoMapper().scheduleUpdate(jobInfo);
XxlJobAdminBootstrap.getInstance().getXxlJobInfoMapper().scheduleUpdate(jobInfo);
}*/
int
batchSize
=
XxlJobAdminBootstrap
.
getInstance
().
getScheduleBatchSize
();
List
<
List
<
XxlJobInfo
>>
scheduleListBatches
=
CollectionTool
.
split
(
scheduleList
,
batchSize
);
for
(
List
<
XxlJobInfo
>
scheduleListBatch
:
scheduleListBatches
)
{
int
totalAffected
=
XxlJobAdminBootstrap
.
getInstance
().
getXxlJobInfoMapper
().
scheduleBatchUpdate
(
scheduleListBatch
);
logger
.
debug
(
">>>>>>>>>>> xxl-job, JobScheduleHelper scheduleBatchUpdate records:"
+
totalAffected
);
}
}
}
else
{
}
else
{
...
...
xxl-job-admin/src/main/java/com/xxl/job/admin/scheduler/type/strategy/FixRateScheduleType.java
View file @
5319b5b
...
@@ -2,6 +2,7 @@ package com.xxl.job.admin.scheduler.type.strategy;
...
@@ -2,6 +2,7 @@ package com.xxl.job.admin.scheduler.type.strategy;
import
com.xxl.job.admin.model.XxlJobInfo
;
import
com.xxl.job.admin.model.XxlJobInfo
;
import
com.xxl.job.admin.scheduler.type.ScheduleType
;
import
com.xxl.job.admin.scheduler.type.ScheduleType
;
import
com.xxl.tool.core.DateTool
;
import
java.util.Date
;
import
java.util.Date
;
...
@@ -9,8 +10,17 @@ public class FixRateScheduleType extends ScheduleType {
...
@@ -9,8 +10,17 @@ public class FixRateScheduleType extends ScheduleType {
@Override
@Override
public
Date
generateNextTriggerTime
(
XxlJobInfo
jobInfo
,
Date
fromTime
)
throws
Exception
{
public
Date
generateNextTriggerTime
(
XxlJobInfo
jobInfo
,
Date
fromTime
)
throws
Exception
{
// generate next trigger time, fix rate delay
// generate next trigger time, fix rate delay
return
new
Date
(
fromTime
.
getTime
()
+
Long
.
parseLong
(
jobInfo
.
getScheduleConf
())
*
1000L
);
Date
nextTriggerTime
=
new
Date
(
fromTime
.
getTime
()
+
Long
.
parseLong
(
jobInfo
.
getScheduleConf
())
*
1000L
);
// assign second:
if
(
nextTriggerTime
.
getTime
()
%
1000
!=
0
)
{
nextTriggerTime
=
DateTool
.
addSeconds
(
DateTool
.
setMilliseconds
(
nextTriggerTime
,
0
),
1
);
}
return
nextTriggerTime
;
}
}
}
}
xxl-job-admin/src/main/resources/application.properties
View file @
5319b5b
...
@@ -64,6 +64,9 @@ xxl.job.i18n=zh_CN
...
@@ -64,6 +64,9 @@ xxl.job.i18n=zh_CN
xxl.job.triggerpool.fast.max
=
300
xxl.job.triggerpool.fast.max
=
300
xxl.job.triggerpool.slow.max
=
200
xxl.job.triggerpool.slow.max
=
200
## xxl-job, schedule batch size
xxl.job.schedule.batchsize
=
100
### xxl-job, log retention days
### xxl-job, log retention days
xxl.job.logretentiondays
=
30
xxl.job.logretentiondays
=
30
...
...
xxl-job-admin/src/main/resources/mapper/XxlJobInfoMapper.xml
View file @
5319b5b
...
@@ -240,34 +240,39 @@
...
@@ -240,34 +240,39 @@
AND trigger_status = 1
AND trigger_status = 1
</update>
</update>
<!--int scheduleUpdateBatch(@Param("list") List<XxlJobInfo> jobs);
<update
id=
"scheduleBatchUpdate"
parameterType=
"java.util.List"
>
<update id="scheduleUpdateBatch" parameterType="java.util.List">
UPDATE xxl_job_info
UPDATE xxl_job_info
SET
SET
trigger_last_time = CASE id
trigger_last_time = CASE id
<foreach collection="list" item="item">
<foreach
collection=
"list"
item=
"item"
separator=
" "
>
WHEN #{item.id} THEN #{item.triggerLastTime}
WHEN #{item.id} THEN #{item.triggerLastTime}
</foreach>
</foreach>
ELSE trigger_last_time
END,
END,
trigger_next_time = CASE id
trigger_next_time = CASE id
<foreach collection="list" item="item">
<foreach
collection=
"list"
item=
"item"
separator=
" "
>
WHEN #{item.id} THEN #{item.triggerNextTime}
WHEN #{item.id} THEN #{item.triggerNextTime}
</foreach>
</foreach>
ELSE trigger_next_time
END,
END,
trigger_status = CASE id
trigger_status = CASE id
<foreach collection="list" item="item">
<foreach
collection=
"list"
item=
"item"
separator=
" "
>
WHEN #{item.id} THEN
WHEN #{item.id} THEN
<choose>
<choose>
<when test="item.triggerStatus >= 0">#{item.triggerStatus}</when>
<when
test=
"item.triggerStatus gte 0"
>
<otherwise>trigger_status</otherwise> <!– 保持原值 –>
#{item.triggerStatus}
</when>
<otherwise>
trigger_status
</otherwise>
</choose>
</choose>
</foreach>
</foreach>
ELSE trigger_status
END
END
WHERE id IN
WHERE id IN
<foreach
collection=
"list"
item=
"item"
open=
"("
separator=
","
close=
")"
>
<foreach
collection=
"list"
item=
"item"
open=
"("
separator=
","
close=
")"
>
#{item.id}
#{item.id}
</foreach>
</foreach>
AND trigger_status = 1
AND trigger_status = 1
</update>-->
</update>
</mapper>
</mapper>
xxl-job-admin/src/main/resources/mapper/XxlJobLogMapper.xml
View file @
5319b5b
...
@@ -48,7 +48,7 @@
...
@@ -48,7 +48,7 @@
SELECT
<include
refid=
"Base_Column_List"
/>
SELECT
<include
refid=
"Base_Column_List"
/>
FROM xxl_job_log AS t
FROM xxl_job_log AS t
<trim
prefix=
"WHERE"
prefixOverrides=
"AND |OR "
>
<trim
prefix=
"WHERE"
prefixOverrides=
"AND |OR "
>
<if
test=
"job
Id==0 and job
Group gt 0"
>
<if
test=
"jobGroup gt 0"
>
AND t.job_group = #{jobGroup}
AND t.job_group = #{jobGroup}
</if>
</if>
<if
test=
"jobId gt 0"
>
<if
test=
"jobId gt 0"
>
...
@@ -82,7 +82,7 @@
...
@@ -82,7 +82,7 @@
SELECT count(1)
SELECT count(1)
FROM xxl_job_log AS t
FROM xxl_job_log AS t
<trim
prefix=
"WHERE"
prefixOverrides=
"AND |OR "
>
<trim
prefix=
"WHERE"
prefixOverrides=
"AND |OR "
>
<if
test=
"job
Id==0 and job
Group gt 0"
>
<if
test=
"jobGroup gt 0"
>
AND t.job_group = #{jobGroup}
AND t.job_group = #{jobGroup}
</if>
</if>
<if
test=
"jobId gt 0"
>
<if
test=
"jobId gt 0"
>
...
...
xxl-job-admin/src/main/resources/templates/biz/log.list.ftl
View file @
5319b5b
...
@@ -37,12 +37,11 @@
...
@@ -37,12 +37,11 @@
<div
class=
"input-group"
>
<div
class=
"input-group"
>
<span
class=
"input-group-addon"
>
${I18n.jobinfo_job}
</span>
<span
class=
"input-group-addon"
>
${I18n.jobinfo_job}
</span>
<select
class=
"form-control"
id=
"jobId"
>
<select
class=
"form-control"
id=
"jobId"
>
<option
value=
"0"
>
${I18n.system_all}
</option>
<
#if jobInfoList?size gt 0>
<
#if jobInfoList?size gt 0>
<
#list jobInfoList as jobItem>
<
#list jobInfoList as jobItem>
<option
value=
"${jobItem.id}"
>
${jobItem.jobDesc}
</option>
<option
value=
"${jobItem.id}"
>
${jobItem.jobDesc}
</option>
<
/#list>
<
/#list>
<
#else>
<option
value=
"0"
>
${I18n.system_selected_nothing}
</option>
<
/#if>
<
/#if>
</select>
</select>
</div>
</div>
...
...
xxl-job-admin/src/test/java/com/xxl/job/admin/mapper/XxlJobInfoMapperTest.java
View file @
5319b5b
package
com
.
xxl
.
job
.
admin
.
mapper
;
package
com
.
xxl
.
job
.
admin
.
mapper
;
import
com.xxl.job.admin.constant.TriggerStatus
;
import
com.xxl.job.admin.model.XxlJobInfo
;
import
com.xxl.job.admin.model.XxlJobInfo
;
import
com.xxl.job.admin.scheduler.config.XxlJobAdminBootstrap
;
import
com.xxl.job.admin.scheduler.misfire.MisfireStrategyEnum
;
import
com.xxl.job.admin.scheduler.misfire.MisfireStrategyEnum
;
import
com.xxl.job.admin.scheduler.type.ScheduleTypeEnum
;
import
com.xxl.job.admin.scheduler.type.ScheduleTypeEnum
;
import
com.xxl.tool.core.CollectionTool
;
import
com.xxl.tool.core.DateTool
;
import
jakarta.annotation.Resource
;
import
jakarta.annotation.Resource
;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.Test
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
...
@@ -83,4 +87,28 @@ public class XxlJobInfoMapperTest {
...
@@ -83,4 +87,28 @@ public class XxlJobInfoMapperTest {
}
}
@Test
public
void
scheduleBatchUpdateTest
(){
List
<
XxlJobInfo
>
list1
=
xxlJobInfoMapper
.
pageList
(
0
,
20
,
0
,
-
1
,
null
,
null
,
null
);
int
batchSize
=
5
;
// update
List
<
XxlJobInfo
>
list2
=
list1
.
stream
().
filter
(
item
->
(
item
.
getId
()>=
4
&&
item
.
getId
()<=
14
)).
toList
();
list2
.
forEach
(
item
->
{
item
.
setTriggerLastTime
(
DateTool
.
addHours
(
new
Date
(),
-
1
).
getTime
());
item
.
setTriggerNextTime
(
DateTool
.
addHours
(
new
Date
(),
1
).
getTime
());
if
(
item
.
getId
()
==
5
)
{
item
.
setTriggerStatus
(
TriggerStatus
.
STOPPED
.
getValue
());
}
});
// batch update
List
<
List
<
XxlJobInfo
>>
scheduleListBatches
=
CollectionTool
.
split
(
list2
,
batchSize
);
for
(
List
<
XxlJobInfo
>
scheduleListBatch
:
scheduleListBatches
)
{
int
totalAffected
=
XxlJobAdminBootstrap
.
getInstance
().
getXxlJobInfoMapper
().
scheduleBatchUpdate
(
scheduleListBatch
);
logger
.
info
(
"scheduleBatchUpdate records:"
+
totalAffected
);
}
}
}
}
xxl-job-core/src/main/java/com/xxl/job/core/openapi/AdminBiz.java
View file @
5319b5b
...
@@ -42,7 +42,20 @@ public interface AdminBiz {
...
@@ -42,7 +42,20 @@ public interface AdminBiz {
public
Response
<
String
>
registryRemove
(
RegistryRequest
registryRequest
);
public
Response
<
String
>
registryRemove
(
RegistryRequest
registryRequest
);
// ---------------------- biz (custome) ----------------------
// ---------------------- job operate ----------------------
// group、job ... manage
// jobAdd
// jobUpdate
// jobDelete
// jobQuery
// jobStart
// jobStop
// jobTrigger
}
}
xxl-job-executor-samples/xxl-job-executor-sample-springboot-ai/src/main/java/com/xxl/job/executor/controller/IndexController.java
View file @
5319b5b
...
@@ -50,7 +50,7 @@ public class IndexController {
...
@@ -50,7 +50,7 @@ public class IndexController {
@Resource
@Resource
private
OllamaChatModel
ollamaChatModel
;
private
OllamaChatModel
ollamaChatModel
;
private
String
prompt
=
"你好,你是一个研发工程师,擅长解决技术类问题。"
;
private
String
prompt
=
"你好,你是一个研发工程师,擅长解决技术类问题。"
;
private
String
modle
=
"qwen3
:0.6
b"
;
private
String
modle
=
"qwen3
.5:2
b"
;
/**
/**
* ChatClient 简单调用
* ChatClient 简单调用
...
...
xxl-job-executor-samples/xxl-job-executor-sample-springboot-ai/src/main/java/com/xxl/job/executor/jobhandler/AIXxlJob.java
View file @
5319b5b
...
@@ -70,7 +70,7 @@ public class AIXxlJob {
...
@@ -70,7 +70,7 @@ public class AIXxlJob {
return
;
return
;
}
}
if
(
ollamaParam
.
getModel
()==
null
||
ollamaParam
.
getModel
().
isBlank
())
{
if
(
ollamaParam
.
getModel
()==
null
||
ollamaParam
.
getModel
().
isBlank
())
{
ollamaParam
.
setModel
(
"qwen3
:0.6
b"
);
ollamaParam
.
setModel
(
"qwen3
.5:2
b"
);
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
XxlJobHelper
.
log
(
new
RuntimeException
(
"OllamaParam parse error"
,
e
));
XxlJobHelper
.
log
(
new
RuntimeException
(
"OllamaParam parse error"
,
e
));
...
...
xxl-job-executor-samples/xxl-job-executor-sample-springboot-ai/src/test/java/com/xxl/job/executor/test/ollama/OllamaTest.java
View file @
5319b5b
...
@@ -32,7 +32,7 @@ public class OllamaTest {
...
@@ -32,7 +32,7 @@ public class OllamaTest {
@Test
@Test
public
void
chatTest
()
{
public
void
chatTest
()
{
String
model
=
"qwen3
:0.6
b"
;
String
model
=
"qwen3
.5:2
b"
;
String
prompt
=
"背景说明:你是一个研发工程师,擅长解决技术类问题。"
;
String
prompt
=
"背景说明:你是一个研发工程师,擅长解决技术类问题。"
;
String
input
=
"请写一个java程序,实现一个方法,输入一个字符串,返回字符串的长度。"
;
String
input
=
"请写一个java程序,实现一个方法,输入一个字符串,返回字符串的长度。"
;
...
@@ -59,7 +59,7 @@ public class OllamaTest {
...
@@ -59,7 +59,7 @@ public class OllamaTest {
@Test
@Test
public
void
chatStreamTest
()
throws
InterruptedException
{
public
void
chatStreamTest
()
throws
InterruptedException
{
String
model
=
"qwen3
:0.6
b"
;
String
model
=
"qwen3
.5:2
b"
;
String
prompt
=
"背景说明:你是一个研发工程师,擅长解决技术类问题。"
;
String
prompt
=
"背景说明:你是一个研发工程师,擅长解决技术类问题。"
;
String
input
=
"请写一个java程序,实现一个方法,输入一个字符串,返回字符串的长度。"
;
String
input
=
"请写一个java程序,实现一个方法,输入一个字符串,返回字符串的长度。"
;
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment