Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
X
XXL-JOB
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
靳帅
XXL-JOB
Commits
1b3ad6fb
提交
1b3ad6fb
authored
4月 26, 2017
作者:
xueli.xue
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
执行器移除GlueLoader依赖,GLUE源码改为推送方式;
上级
617ed697
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
16 行增加
和
39 行删除
+16
-39
RemoteHttpJobBean.java
...ava/com/xxl/job/admin/core/jobbean/RemoteHttpJobBean.java
+1
-1
ExecutorBizImpl.java
.../main/java/com/xxl/job/core/biz/impl/ExecutorBizImpl.java
+2
-9
TriggerParam.java
...rc/main/java/com/xxl/job/core/biz/model/TriggerParam.java
+9
-0
GlueFactory.java
...core/src/main/java/com/xxl/job/core/glue/GlueFactory.java
+2
-18
applicationcontext-xxl-job.xml
...example/src/main/resources/applicationcontext-xxl-job.xml
+2
-11
没有找到文件。
xxl-job-admin/src/main/java/com/xxl/job/admin/core/jobbean/RemoteHttpJobBean.java
浏览文件 @
1b3ad6fb
...
...
@@ -10,7 +10,6 @@ import com.xxl.job.admin.core.thread.JobRegistryHelper;
import
com.xxl.job.core.biz.ExecutorBiz
;
import
com.xxl.job.core.biz.model.ReturnT
;
import
com.xxl.job.core.biz.model.TriggerParam
;
import
com.xxl.job.core.glue.GlueTypeEnum
;
import
com.xxl.job.core.registry.RegistHelper
;
import
com.xxl.job.core.rpc.netcom.NetComClientProxy
;
import
org.apache.commons.collections.CollectionUtils
;
...
...
@@ -61,6 +60,7 @@ public class RemoteHttpJobBean extends QuartzJobBean {
triggerParam
.
setExecutorHandler
(
jobInfo
.
getExecutorHandler
());
triggerParam
.
setExecutorParams
(
jobInfo
.
getExecutorParam
());
triggerParam
.
setGlueType
(
jobInfo
.
getGlueType
());
triggerParam
.
setGlueSource
(
jobInfo
.
getGlueSource
());
triggerParam
.
setGlueUpdatetime
(
jobInfo
.
getGlueUpdatetime
().
getTime
());
triggerParam
.
setLogId
(
jobLog
.
getId
());
triggerParam
.
setLogDateTim
(
jobLog
.
getTriggerTime
().
getTime
());
...
...
xxl-job-core/src/main/java/com/xxl/job/core/biz/impl/ExecutorBizImpl.java
浏览文件 @
1b3ad6fb
...
...
@@ -58,7 +58,6 @@ public class ExecutorBizImpl implements ExecutorBiz {
JobThread
jobThread
=
XxlJobExecutor
.
loadJobThread
(
triggerParam
.
getJobId
());
if
(
GlueTypeEnum
.
BEAN
==
GlueTypeEnum
.
match
(
triggerParam
.
getGlueType
()))
{
// bean model
// valid handler
IJobHandler
jobHandler
=
XxlJobExecutor
.
loadJobHandler
(
triggerParam
.
getExecutorHandler
());
...
...
@@ -80,13 +79,7 @@ public class ExecutorBizImpl implements ExecutorBiz {
jobThread
=
XxlJobExecutor
.
registJobThread
(
triggerParam
.
getJobId
(),
jobHandler
);
}
}
else
{
// glue model
// valid glueloader
if
(!
GlueFactory
.
isActive
())
{
return
new
ReturnT
<
String
>(
ReturnT
.
FAIL_CODE
,
"glueLoader for JobId=["
+
triggerParam
.
getJobId
()
+
"] not found."
);
}
}
else
if
(
GlueTypeEnum
.
GLUE_GROOVY
==
GlueTypeEnum
.
match
(
triggerParam
.
getGlueType
()))
{
// valid exists job thread:change handler or glue timeout, need kill old thread
if
(
jobThread
!=
null
&&
...
...
@@ -103,7 +96,7 @@ public class ExecutorBizImpl implements ExecutorBiz {
if
(
jobThread
==
null
)
{
IJobHandler
jobHandler
=
null
;
try
{
jobHandler
=
GlueFactory
.
getInstance
().
loadNewInstance
(
triggerParam
.
get
JobId
());
jobHandler
=
GlueFactory
.
getInstance
().
loadNewInstance
(
triggerParam
.
get
GlueSource
());
}
catch
(
Exception
e
)
{
logger
.
error
(
""
,
e
);
return
new
ReturnT
<
String
>(
ReturnT
.
FAIL_CODE
,
e
.
getMessage
());
...
...
xxl-job-core/src/main/java/com/xxl/job/core/biz/model/TriggerParam.java
浏览文件 @
1b3ad6fb
...
...
@@ -15,6 +15,7 @@ public class TriggerParam implements Serializable{
private
String
executorParams
;
private
String
glueType
;
private
String
glueSource
;
private
long
glueUpdatetime
;
private
int
logId
;
...
...
@@ -54,6 +55,14 @@ public class TriggerParam implements Serializable{
this
.
glueType
=
glueType
;
}
public
String
getGlueSource
()
{
return
glueSource
;
}
public
void
setGlueSource
(
String
glueSource
)
{
this
.
glueSource
=
glueSource
;
}
public
long
getGlueUpdatetime
()
{
return
glueUpdatetime
;
}
...
...
xxl-job-core/src/main/java/com/xxl/job/core/glue/GlueFactory.java
浏览文件 @
1b3ad6fb
package
com
.
xxl
.
job
.
core
.
glue
;
import
com.xxl.job.core.glue.loader.GlueLoader
;
import
com.xxl.job.core.handler.IJobHandler
;
import
groovy.lang.GroovyClassLoader
;
import
org.slf4j.Logger
;
...
...
@@ -27,17 +26,6 @@ public class GlueFactory implements ApplicationContextAware {
* groovy class loader
*/
private
GroovyClassLoader
groovyClassLoader
=
new
GroovyClassLoader
();
/**
* code source loader
*/
private
GlueLoader
glueLoader
;
public
void
setGlueLoader
(
GlueLoader
glueLoader
)
{
this
.
glueLoader
=
glueLoader
;
}
public
static
boolean
isActive
()
{
return
GlueFactory
.
glueFactory
.
glueLoader
!=
null
;
}
// ----------------------------- spring support -----------------------------
private
static
ApplicationContext
applicationContext
;
...
...
@@ -56,7 +44,7 @@ public class GlueFactory implements ApplicationContextAware {
* inject action of spring
* @param instance
*/
p
ublic
void
injectService
(
Object
instance
){
p
rivate
void
injectService
(
Object
instance
){
if
(
instance
==
null
)
{
return
;
}
...
...
@@ -106,11 +94,7 @@ public class GlueFactory implements ApplicationContextAware {
// ----------------------------- load instance -----------------------------
// load new instance, prototype
public
IJobHandler
loadNewInstance
(
int
jobId
)
throws
Exception
{
if
(
jobId
==
0
)
{
return
null
;
}
String
codeSource
=
glueLoader
.
load
(
jobId
);
public
IJobHandler
loadNewInstance
(
String
codeSource
)
throws
Exception
{
if
(
codeSource
!=
null
&&
codeSource
.
trim
().
length
()>
0
)
{
Class
<?>
clazz
=
groovyClassLoader
.
parseClass
(
codeSource
);
if
(
clazz
!=
null
)
{
...
...
xxl-job-executor-example/src/main/resources/applicationcontext-xxl-job.xml
浏览文件 @
1b3ad6fb
...
...
@@ -41,18 +41,9 @@
<!-- ********************************* "GlueFactory" 配置, 仅在启动 "GLUE模式任务" 时才需要, 否则可删除 ********************************* -->
<!-- 配置03、GlueFactory -->
<bean
id=
"glueFactory"
class=
"com.xxl.job.core.glue.GlueFactory"
>
<!-- GLUE源码加载器,默认使用系统提供的 "DbGlueLoader", 推荐将其改为公共的RPC服务 -->
<property
name=
"glueLoader"
>
<!-- DbGlueLoader, 依赖 "XXL-JOB公共数据源" -->
<bean
class=
"com.xxl.job.core.glue.loader.impl.DbGlueLoader"
>
<!-- XXL-JOB公共数据源 -->
<property
name=
"dataSource"
ref=
"xxlJobDataSource"
/>
</bean>
</property>
</bean>
<bean
id=
"glueFactory"
class=
"com.xxl.job.core.glue.GlueFactory"
/>
<!-- ********************************* "XXL-JOB公共数据源" 配置, 仅在启动 "DbRegistHelper"
或 "DbGlueLoader"
时才需要, 否则可删除 ********************************* -->
<!-- ********************************* "XXL-JOB公共数据源" 配置, 仅在启动 "DbRegistHelper" 时才需要, 否则可删除 ********************************* -->
<!-- 配置04、XXL-JOB公共数据源 -->
<bean
id=
"xxlJobDataSource"
class=
"com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method=
"close"
>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论