Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
熊鹏飞
/
xxljob220
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
55294916
authored
Sep 30, 2016
by
xueli.xue
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
GLUE任务调度时,执行器校验是否支持GLUE模式任务,校验GlueFactory的glueloader是否存在;
parent
2acaf0c2
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
3 deletions
xxl-job-core/src/main/java/com/xxl/job/core/glue/GlueFactory.java
xxl-job-core/src/main/java/com/xxl/job/core/router/action/RunAction.java
xxl-job-executor-example/src/main/resources/applicationcontext-xxl-job.xml
xxl-job-core/src/main/java/com/xxl/job/core/glue/GlueFactory.java
View file @
55294916
...
...
@@ -43,6 +43,9 @@ public class GlueFactory implements ApplicationContextAware {
public
void
setGlueLoader
(
GlueLoader
glueLoader
)
{
this
.
glueLoader
=
glueLoader
;
}
public
static
boolean
isActive
()
{
return
GlueFactory
.
glueFactory
.
glueLoader
!=
null
;
}
// ----------------------------- spring support -----------------------------
private
static
ApplicationContext
applicationContext
;
...
...
@@ -122,7 +125,7 @@ public class GlueFactory implements ApplicationContextAware {
}
// // load instance, singleton
p
ublic
static
String
generateInstanceCacheKey
(
String
job_group
,
String
job_name
){
p
rivate
static
String
generateInstanceCacheKey
(
String
job_group
,
String
job_name
){
return
job_group
.
concat
(
"_"
).
concat
(
job_name
).
concat
(
"_instance"
);
}
public
IJobHandler
loadInstance
(
String
job_group
,
String
job_name
)
throws
Exception
{
...
...
xxl-job-core/src/main/java/com/xxl/job/core/router/action/RunAction.java
View file @
55294916
package
com
.
xxl
.
job
.
core
.
router
.
action
;
import
com.xxl.job.core.glue.GlueFactory
;
import
com.xxl.job.core.handler.IJobHandler
;
import
com.xxl.job.core.handler.impl.GlueJobHandler
;
import
com.xxl.job.core.router.HandlerRouter
;
...
...
@@ -25,7 +26,7 @@ public class RunAction extends IAction {
if
(!
requestModel
.
isGlueSwitch
())
{
// bean model
// handler instance
//
valid
handler instance
IJobHandler
jobHandler
=
HandlerRouter
.
loadJobHandler
(
requestModel
.
getExecutorHandler
());
if
(
jobHandler
==
null
)
{
return
new
ResponseModel
(
ResponseModel
.
FAIL
,
"job handler for jobKey=["
+
jobKey
+
"] not found."
);
...
...
@@ -46,6 +47,12 @@ public class RunAction extends IAction {
}
}
else
{
// glue model
// valid glueloader
if
(!
GlueFactory
.
isActive
())
{
return
new
ResponseModel
(
ResponseModel
.
FAIL
,
"glueLoader for jobKey=["
+
jobKey
+
"] not found."
);
}
if
(
jobThread
==
null
)
{
jobThread
=
HandlerRouter
.
registJobThread
(
jobKey
,
new
GlueJobHandler
(
requestModel
.
getJobGroup
(),
requestModel
.
getJobName
()));
}
else
{
...
...
xxl-job-executor-example/src/main/resources/applicationcontext-xxl-job.xml
View file @
55294916
...
...
@@ -16,8 +16,9 @@
<property
name=
"port"
value=
"9999"
/>
</bean>
<!-- glue factory -->
<bean
id=
"glueFactory"
class=
"com.xxl.job.core.glue.GlueFactory"
>
<property
name=
"cacheTimeout"
value=
"
5
000"
/>
<property
name=
"cacheTimeout"
value=
"
10
000"
/>
<property
name=
"glueLoader"
ref=
"dbGlueLoader"
/>
<!-- GLUE 代码加载器,推荐将该服务配置成RPC服务 -->
</bean>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment