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
17e7dd5a
authored
May 11, 2017
by
xueli.xue
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
底层优化
parent
650682d2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
12 deletions
xxl-job-core/src/main/java/com/xxl/job/core/thread/ExecutorRegistryThread.java
xxl-job-core/src/main/java/com/xxl/job/core/util/AdminApiUtil.java
xxl-job-core/src/main/java/com/xxl/job/core/thread/ExecutorRegistryThread.java
View file @
17e7dd5a
...
@@ -26,7 +26,7 @@ public class ExecutorRegistryThread extends Thread {
...
@@ -26,7 +26,7 @@ public class ExecutorRegistryThread extends Thread {
public
void
start
(
final
int
port
,
final
String
ip
,
final
String
appName
){
public
void
start
(
final
int
port
,
final
String
ip
,
final
String
appName
){
// valid
// valid
if
(
AdminApiUtil
.
allowCallApi
&&
(
appName
!=
null
&&
appName
.
trim
().
length
()>
0
)
)
{
if
(
!(
AdminApiUtil
.
allowCallApi
()
&&
(
appName
!=
null
&&
appName
.
trim
().
length
()>
0
)
)
)
{
logger
.
warn
(
">>>>>>>>>>>> xxl-job, executor registry config fail"
);
logger
.
warn
(
">>>>>>>>>>>> xxl-job, executor registry config fail"
);
return
;
return
;
}
}
...
...
xxl-job-core/src/main/java/com/xxl/job/core/util/AdminApiUtil.java
View file @
17e7dd5a
...
@@ -28,30 +28,27 @@ public class AdminApiUtil {
...
@@ -28,30 +28,27 @@ public class AdminApiUtil {
public
static
final
String
REGISTRY
=
"/api/registry"
;
public
static
final
String
REGISTRY
=
"/api/registry"
;
private
static
List
<
String
>
adminAddressList
=
null
;
private
static
List
<
String
>
adminAddressList
=
null
;
public
static
boolean
allowCallApi
=
true
;
public
static
void
init
(
String
adminAddresses
){
public
static
void
init
(
String
adminAddresses
){
// admin assress list
// admin assress list
if
(
adminAddresses
!=
null
)
{
if
(
adminAddresses
!=
null
)
{
Set
<
String
>
adminAddressSet
=
new
HashSet
<
String
>();
Set
<
String
>
adminAddressSet
=
new
HashSet
<
String
>();
for
(
String
adminAddressItem:
adminAddresses
.
split
(
","
))
{
for
(
String
adminAddressItem:
adminAddresses
.
split
(
","
))
{
if
(
adminAddressItem
.
trim
().
length
()>
0
&&
!
adminAddressSet
.
contains
(
adminAddressItem
)
)
{
if
(
adminAddressItem
.
trim
().
length
()>
0
)
{
adminAddressSet
.
add
(
adminAddressItem
);
adminAddressSet
.
add
(
adminAddressItem
);
}
}
}
}
if
(
adminAddressSet
==
null
||
adminAddressSet
.
size
()==
0
)
{
adminAddressList
=
new
ArrayList
<
String
>(
adminAddressSet
);
adminAddressList
=
new
ArrayList
<
String
>(
adminAddressSet
);
}
}
}
// parse
allowCallApi
=
(
adminAddressList
!=
null
&&
adminAddressList
.
size
()>
0
);
}
}
public
static
boolean
allowCallApi
(){
boolean
allowCallApi
=
(
adminAddressList
!=
null
&&
adminAddressList
.
size
()>
0
);
return
allowCallApi
;
}
public
static
ReturnT
<
String
>
callApiFailover
(
String
subUrl
,
Object
requestObj
)
throws
Exception
{
public
static
ReturnT
<
String
>
callApiFailover
(
String
subUrl
,
Object
requestObj
)
throws
Exception
{
if
(!
allowCallApi
)
{
if
(!
allowCallApi
()
)
{
return
new
ReturnT
<
String
>(
ReturnT
.
FAIL_CODE
,
"allowCall
back
fail."
);
return
new
ReturnT
<
String
>(
ReturnT
.
FAIL_CODE
,
"allowCall
Api
fail."
);
}
}
for
(
String
adminAddress:
adminAddressList
)
{
for
(
String
adminAddress:
adminAddressList
)
{
...
...
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