Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
X
XXL-JOB
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
靳帅
XXL-JOB
Commits
0f0906ee
提交
0f0906ee
authored
3月 12, 2016
作者:
xueli.xue
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
重构调度服务注入方式
上级
d81b0749
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
25 行增加
和
16 行删除
+25
-16
DynamicSchedulerUtil.java
...main/java/com/xxl/job/core/util/DynamicSchedulerUtil.java
+17
-16
DemoConcurrentJobBean.java
...a/com/xxl/job/service/job/impl/DemoConcurrentJobBean.java
+4
-0
DemoNomalJobBean.java
...n/java/com/xxl/job/service/job/impl/DemoNomalJobBean.java
+4
-0
没有找到文件。
xxl-job-admin/src/main/java/com/xxl/job/core/util/DynamicSchedulerUtil.java
浏览文件 @
0f0906ee
...
...
@@ -8,8 +8,6 @@ import java.util.List;
import
java.util.Map
;
import
java.util.Set
;
import
javax.annotation.Resource
;
import
org.quartz.CronScheduleBuilder
;
import
org.quartz.CronTrigger
;
import
org.quartz.Job
;
...
...
@@ -27,7 +25,10 @@ import org.quartz.impl.matchers.GroupMatcher;
import
org.quartz.impl.triggers.CronTriggerImpl
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.InitializingBean
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.ApplicationContextAware
;
import
org.springframework.util.Assert
;
import
com.xxl.job.client.util.JacksonUtil
;
...
...
@@ -39,32 +40,30 @@ import com.xxl.job.dao.IXxlJobLogDao;
* base quartz scheduler util
* @author xuxueli 2015-12-19 16:13:53
*/
public
final
class
DynamicSchedulerUtil
implements
InitializingBean
{
public
final
class
DynamicSchedulerUtil
implements
ApplicationContextAware
,
InitializingBean
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
DynamicSchedulerUtil
.
class
);
// xxlJobLogDao
public
static
IXxlJobLogDao
xxlJobLogDao
;
@Resource
public
void
setXxlJobLogDao
(
IXxlJobLogDao
xxlJobLogDao
)
{
DynamicSchedulerUtil
.
xxlJobLogDao
=
xxlJobLogDao
;
}
// xxlJobInfoDao
public
static
IXxlJobInfoDao
xxlJobInfoDao
;
@Resource
public
void
setXxlJobInfoDao
(
IXxlJobInfoDao
xxlJobInfoDao
)
{
DynamicSchedulerUtil
.
xxlJobInfoDao
=
xxlJobInfoDao
;
}
// Scheduler
private
static
Scheduler
scheduler
;
public
static
void
setScheduler
(
Scheduler
scheduler
)
{
DynamicSchedulerUtil
.
scheduler
=
scheduler
;
}
// xxlJobLogDao、xxlJobInfoDao
public
static
IXxlJobLogDao
xxlJobLogDao
;
public
static
IXxlJobInfoDao
xxlJobInfoDao
;
@Override
public
void
setApplicationContext
(
ApplicationContext
applicationContext
)
throws
BeansException
{
DynamicSchedulerUtil
.
xxlJobLogDao
=
applicationContext
.
getBean
(
IXxlJobLogDao
.
class
);
DynamicSchedulerUtil
.
xxlJobInfoDao
=
applicationContext
.
getBean
(
IXxlJobInfoDao
.
class
);
}
@Override
public
void
afterPropertiesSet
()
throws
Exception
{
Assert
.
notNull
(
scheduler
,
"quartz scheduler is null"
);
logger
.
info
(
">>>>>>>>> init quartz scheduler success.[{}]"
,
scheduler
);
}
// getJobKeys
...
...
@@ -266,4 +265,5 @@ public final class DynamicSchedulerUtil implements InitializingBean {
return
result
;
}
}
\ No newline at end of file
xxl-job-admin/src/main/java/com/xxl/job/service/job/impl/DemoConcurrentJobBean.java
浏览文件 @
0f0906ee
...
...
@@ -6,6 +6,10 @@ import org.quartz.DisallowConcurrentExecution;
import
com.xxl.job.service.job.LocalNomalJobBean
;
/**
* demo job bean for no-concurrent
* @author xuxueli 2016-3-12 14:25:14
*/
@DisallowConcurrentExecution
// 串行;线程数要多配置几个,否则不生效;
public
class
DemoConcurrentJobBean
extends
LocalNomalJobBean
{
...
...
xxl-job-admin/src/main/java/com/xxl/job/service/job/impl/DemoNomalJobBean.java
浏览文件 @
0f0906ee
...
...
@@ -7,6 +7,10 @@ import org.slf4j.LoggerFactory;
import
com.xxl.job.service.job.LocalNomalJobBean
;
/**
* demo job bean for concurrent
* @author xuxueli 2016-3-12 14:25:57
*/
public
class
DemoNomalJobBean
extends
LocalNomalJobBean
{
private
static
Logger
Logger
=
LoggerFactory
.
getLogger
(
DemoNomalJobBean
.
class
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论