Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
yanghaoyuan.sh
DolphinScheduler
提交
8085e931
DolphinScheduler
项目概览
yanghaoyuan.sh
/
DolphinScheduler
与 Fork 源项目一致
Fork自
apache / DolphinScheduler
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
DolphinScheduler
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
8085e931
编写于
3月 21, 2020
作者:
G
gabry.wu
提交者:
GitHub
3月 21, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Adapting partial code(file name start with Q) to the sonar cloud rule (#2242)
上级
ca6872a9
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
17 addition
and
18 deletion
+17
-18
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/QueueService.java
...org/apache/dolphinscheduler/api/service/QueueService.java
+12
-14
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/QueueMapperTest.java
...g/apache/dolphinscheduler/dao/mapper/QueueMapperTest.java
+2
-2
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/QuartzExecutors.java
...ache/dolphinscheduler/service/quartz/QuartzExecutors.java
+3
-2
未找到文件。
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/QueueService.java
浏览文件 @
8085e931
...
...
@@ -20,6 +20,7 @@ import org.apache.dolphinscheduler.api.enums.Status;
import
org.apache.dolphinscheduler.api.utils.PageInfo
;
import
org.apache.dolphinscheduler.api.utils.Result
;
import
org.apache.dolphinscheduler.common.Constants
;
import
org.apache.dolphinscheduler.common.utils.CollectionUtils
;
import
org.apache.dolphinscheduler.dao.entity.Queue
;
import
org.apache.dolphinscheduler.dao.entity.User
;
import
org.apache.dolphinscheduler.dao.mapper.QueueMapper
;
...
...
@@ -43,7 +44,7 @@ import java.util.Map;
@Service
public
class
QueueService
extends
BaseService
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
Tenant
Service
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
Queue
Service
.
class
);
@Autowired
private
QueueMapper
queueMapper
;
...
...
@@ -186,20 +187,17 @@ public class QueueService extends BaseService {
}
// check queue name is exist
if
(!
queueName
.
equals
(
queueObj
.
getQueueName
())
)
{
if
(
checkQueueNameExist
(
queueName
))
{
if
(!
queueName
.
equals
(
queueObj
.
getQueueName
())
&&
checkQueueNameExist
(
queueName
))
{
putMsg
(
result
,
Status
.
QUEUE_NAME_EXIST
,
queueName
);
return
result
;
}
}
// check queue value is exist
if
(!
queue
.
equals
(
queueObj
.
getQueue
()))
{
if
(
checkQueueExist
(
queue
))
{
if
(!
queue
.
equals
(
queueObj
.
getQueue
())
&&
checkQueueExist
(
queue
))
{
putMsg
(
result
,
Status
.
QUEUE_VALUE_EXIST
,
queue
);
return
result
;
}
}
// check old queue using by any user
if
(
checkIfQueueIsInUsing
(
queueObj
.
getQueueName
(),
queueName
))
{
...
...
@@ -267,7 +265,7 @@ public class QueueService extends BaseService {
* @return true if the queue not exists, otherwise return false
*/
private
boolean
checkQueueExist
(
String
queue
)
{
return
queueMapper
.
queryAllQueueList
(
queue
,
null
).
size
()
>
0
;
return
CollectionUtils
.
isNotEmpty
(
queueMapper
.
queryAllQueueList
(
queue
,
null
))
;
}
/**
...
...
@@ -278,7 +276,7 @@ public class QueueService extends BaseService {
* @return true if the queue name not exists, otherwise return false
*/
private
boolean
checkQueueNameExist
(
String
queueName
)
{
return
queueMapper
.
queryAllQueueList
(
null
,
queueName
).
size
()
>
0
;
return
CollectionUtils
.
isNotEmpty
(
queueMapper
.
queryAllQueueList
(
null
,
queueName
))
;
}
/**
...
...
@@ -290,7 +288,7 @@ public class QueueService extends BaseService {
* @return true if need to update user
*/
private
boolean
checkIfQueueIsInUsing
(
String
oldQueue
,
String
newQueue
)
{
return
!
oldQueue
.
equals
(
newQueue
)
&&
userMapper
.
queryUserListByQueue
(
oldQueue
).
size
()
>
0
;
return
!
oldQueue
.
equals
(
newQueue
)
&&
CollectionUtils
.
isNotEmpty
(
userMapper
.
queryUserListByQueue
(
oldQueue
))
;
}
}
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/QueueMapperTest.java
浏览文件 @
8085e931
...
...
@@ -64,7 +64,7 @@ public class QueueMapperTest {
queue
.
setCreateTime
(
new
Date
());
//update
int
update
=
queueMapper
.
updateById
(
queue
);
Assert
.
assertEquals
(
update
,
1
);
Assert
.
assertEquals
(
1
,
update
);
queueMapper
.
deleteById
(
queue
.
getId
());
}
...
...
@@ -75,7 +75,7 @@ public class QueueMapperTest {
public
void
testDelete
(){
Queue
queue
=
insertOne
();
int
delete
=
queueMapper
.
deleteById
(
queue
.
getId
());
Assert
.
assertEquals
(
delete
,
1
);
Assert
.
assertEquals
(
1
,
delete
);
}
/**
...
...
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/QuartzExecutors.java
浏览文件 @
8085e931
...
...
@@ -70,9 +70,10 @@ public class QuartzExecutors {
synchronized
(
QuartzExecutors
.
class
)
{
// when more than two threads run into the first null check same time, to avoid instanced more than one time, it needs to be checked again.
if
(
INSTANCE
==
null
)
{
INSTANCE
=
new
QuartzExecutors
();
QuartzExecutors
quartzExecutors
=
new
QuartzExecutors
();
//finish QuartzExecutors init
INSTANCE
.
init
();
quartzExecutors
.
init
();
INSTANCE
=
quartzExecutors
;
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录