Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
DolphinScheduler
提交
a388b685
DolphinScheduler
项目概览
apache
/
DolphinScheduler
上一次同步 1 年多
通知
705
Star
9572
Fork
3514
代码
文件
提交
分支
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,体验更适合开发者的 AI 搜索 >>
未验证
提交
a388b685
编写于
2月 27, 2021
作者:
Z
zhuangchong
提交者:
GitHub
2月 27, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Optimize HashMap Initial Capacity. (#4896)
上级
d170b92d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
11 addition
and
4 deletion
+11
-4
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/BaseController.java
...pache/dolphinscheduler/api/controller/BaseController.java
+2
-2
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/CollectionUtils.java
...apache/dolphinscheduler/common/utils/CollectionUtils.java
+8
-1
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/QuartzExecutors.java
...ache/dolphinscheduler/service/quartz/QuartzExecutors.java
+1
-1
未找到文件。
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/BaseController.java
浏览文件 @
a388b685
...
...
@@ -48,7 +48,7 @@ public class BaseController {
* @return check result code
*/
public
Map
<
String
,
Object
>
checkPageParams
(
int
pageNo
,
int
pageSize
)
{
Map
<
String
,
Object
>
result
=
new
HashMap
<>(
2
);
Map
<
String
,
Object
>
result
=
new
HashMap
<>(
4
);
Status
resultEnum
=
Status
.
SUCCESS
;
String
msg
=
Status
.
SUCCESS
.
getMsg
();
if
(
pageNo
<=
0
)
{
...
...
@@ -202,7 +202,7 @@ public class BaseController {
result
.
setCode
(
Status
.
SUCCESS
.
getCode
());
result
.
setMsg
(
Status
.
SUCCESS
.
getMsg
());
Map
<
String
,
Object
>
map
=
new
HashMap
<>(
4
);
Map
<
String
,
Object
>
map
=
new
HashMap
<>(
8
);
map
.
put
(
Constants
.
TOTAL_LIST
,
totalList
);
map
.
put
(
Constants
.
CURRENT_PAGE
,
currentPage
);
map
.
put
(
Constants
.
TOTAL_PAGE
,
totalPage
);
...
...
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/CollectionUtils.java
浏览文件 @
a388b685
...
...
@@ -46,6 +46,11 @@ public class CollectionUtils {
throw
new
UnsupportedOperationException
(
"Construct CollectionUtils"
);
}
/**
* The load factor used when none specified in constructor.
*/
static
final
float
DEFAULT_LOAD_FACTOR
=
0.75f
;
/**
* Returns a new {@link Collection} containing <i>a</i> minus a subset of
* <i>b</i>. Only the elements of <i>b</i> that satisfy the predicate
...
...
@@ -95,6 +100,7 @@ public class CollectionUtils {
* @return string to map
*/
public
static
Map
<
String
,
String
>
stringToMap
(
String
str
,
String
separator
,
String
keyPrefix
)
{
Map
<
String
,
String
>
emptyMap
=
new
HashMap
<>(
0
);
if
(
StringUtils
.
isEmpty
(
str
))
{
return
emptyMap
;
...
...
@@ -103,7 +109,8 @@ public class CollectionUtils {
return
emptyMap
;
}
String
[]
strings
=
str
.
split
(
separator
);
Map
<
String
,
String
>
map
=
new
HashMap
<>(
strings
.
length
);
int
initialCapacity
=
(
int
)(
strings
.
length
/
DEFAULT_LOAD_FACTOR
)
+
1
;
Map
<
String
,
String
>
map
=
new
HashMap
<>(
initialCapacity
);
for
(
int
i
=
0
;
i
<
strings
.
length
;
i
++)
{
String
[]
strArray
=
strings
[
i
].
split
(
"="
);
if
(
strArray
.
length
!=
2
)
{
...
...
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/QuartzExecutors.java
浏览文件 @
a388b685
...
...
@@ -370,7 +370,7 @@ public class QuartzExecutors {
* @return data map
*/
public
static
Map
<
String
,
Object
>
buildDataMap
(
int
projectId
,
int
scheduleId
,
Schedule
schedule
)
{
Map
<
String
,
Object
>
dataMap
=
new
HashMap
<>(
3
);
Map
<
String
,
Object
>
dataMap
=
new
HashMap
<>(
8
);
dataMap
.
put
(
PROJECT_ID
,
projectId
);
dataMap
.
put
(
SCHEDULE_ID
,
scheduleId
);
dataMap
.
put
(
SCHEDULE
,
JSONUtils
.
toJsonString
(
schedule
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录