Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
byit-myth-job
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liyuan
byit-myth-job
Commits
00c3f6ab
Commit
00c3f6ab
authored
Jan 15, 2020
by
huangfusuper
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【代码调整】调整扫描顺序,当扫描数据为空时!先释放资源,再睡眠!避免死锁!
parent
22d606e0
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
7 deletions
+23
-7
JobScheduleHelper.java
...core/src/main/java/com/byit/thread/JobScheduleHelper.java
+0
-2
LogScanHelper.java
...min-core/src/main/java/com/byit/thread/LogScanHelper.java
+15
-2
RunRecordingScanHelper.java
...src/main/java/com/byit/thread/RunRecordingScanHelper.java
+8
-3
No files found.
byit-myth-core/myth-admin-core/src/main/java/com/byit/thread/JobScheduleHelper.java
View file @
00c3f6ab
...
@@ -131,8 +131,6 @@ public class JobScheduleHelper{
...
@@ -131,8 +131,6 @@ public class JobScheduleHelper{
//在日志表里面创建一条记录
//在日志表里面创建一条记录
//根据 map_flow_id查询当前的版本的工作流 使用祝工作流的runId 保存到执行记录表和任务表
//根据 map_flow_id查询当前的版本的工作流 使用祝工作流的runId 保存到执行记录表和任务表
}
else
{
}
else
{
if
(
"start"
.
equals
(
jobTask
.
getNodeName
())
){
if
(
"start"
.
equals
(
jobTask
.
getNodeName
())
){
log
.
debug
(
"任务:{}"
,
jobTask
);
log
.
debug
(
"任务:{}"
,
jobTask
);
JobTaskSchedule
jobTaskSchedule
=
new
JobTaskSchedule
();
JobTaskSchedule
jobTaskSchedule
=
new
JobTaskSchedule
();
...
...
byit-myth-core/myth-admin-core/src/main/java/com/byit/thread/LogScanHelper.java
View file @
00c3f6ab
...
@@ -75,6 +75,8 @@ public class LogScanHelper {
...
@@ -75,6 +75,8 @@ public class LogScanHelper {
dateAligned
(
5000
);
dateAligned
(
5000
);
log
.
info
(
"---------------------【com.byit.thread.LogScanHelper#virtualNodeScanMethod】init success------------------------"
);
log
.
info
(
"---------------------【com.byit.thread.LogScanHelper#virtualNodeScanMethod】init success------------------------"
);
while
(!
virtualNodeScanIsStop
){
while
(!
virtualNodeScanIsStop
){
//是否需要睡眠
boolean
isSleep
=
false
;
Connection
conn
=
null
;
Connection
conn
=
null
;
Boolean
connAutoCommit
=
null
;
Boolean
connAutoCommit
=
null
;
PreparedStatement
preparedStatement
=
null
;
PreparedStatement
preparedStatement
=
null
;
...
@@ -102,7 +104,7 @@ public class LogScanHelper {
...
@@ -102,7 +104,7 @@ public class LogScanHelper {
}
}
});
});
}
else
{
}
else
{
dateAligned
(
20000
)
;
isSleep
=
true
;
}
}
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
e
.
printStackTrace
();
e
.
printStackTrace
();
...
@@ -146,6 +148,10 @@ public class LogScanHelper {
...
@@ -146,6 +148,10 @@ public class LogScanHelper {
}
}
}
}
}
}
if
(
isSleep
){
dateAligned
(
20000
);
}
}
}
});
});
...
@@ -162,6 +168,7 @@ public class LogScanHelper {
...
@@ -162,6 +168,7 @@ public class LogScanHelper {
dateAligned
(
5000
);
dateAligned
(
5000
);
log
.
info
(
"---------------------【com.byit.thread.LogScanHelper#notAlarmedNodeScanMethod】init success------------------------"
);
log
.
info
(
"---------------------【com.byit.thread.LogScanHelper#notAlarmedNodeScanMethod】init success------------------------"
);
while
(!
notAlarmedNodeScanIsStop
){
while
(!
notAlarmedNodeScanIsStop
){
boolean
isSleep
=
false
;
Connection
conn
=
null
;
Connection
conn
=
null
;
Boolean
connAutoCommit
=
null
;
Boolean
connAutoCommit
=
null
;
PreparedStatement
preparedStatement
=
null
;
PreparedStatement
preparedStatement
=
null
;
...
@@ -186,11 +193,13 @@ public class LogScanHelper {
...
@@ -186,11 +193,13 @@ public class LogScanHelper {
jobTaskRunLogService
.
updateJobTaskRunLog
(
endNode
);
jobTaskRunLogService
.
updateJobTaskRunLog
(
endNode
);
});
});
}
else
{
}
else
{
dateAligned
(
20000
)
;
isSleep
=
true
;
}
}
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
if
(!
notAlarmedNodeScanIsStop
){
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
finally
{
}
finally
{
if
(
conn
!=
null
){
if
(
conn
!=
null
){
try
{
try
{
...
@@ -230,6 +239,10 @@ public class LogScanHelper {
...
@@ -230,6 +239,10 @@ public class LogScanHelper {
}
}
}
}
}
}
if
(
isSleep
){
dateAligned
(
20000
);
}
}
}
});
});
notAlarmedNodeScanThread
.
setName
(
"myth-job#【LogScanHelper】#notAlarmedNodeScanThread"
);
notAlarmedNodeScanThread
.
setName
(
"myth-job#【LogScanHelper】#notAlarmedNodeScanThread"
);
...
...
byit-myth-core/myth-admin-core/src/main/java/com/byit/thread/RunRecordingScanHelper.java
View file @
00c3f6ab
...
@@ -62,12 +62,11 @@ public class RunRecordingScanHelper {
...
@@ -62,12 +62,11 @@ public class RunRecordingScanHelper {
}
}
public
void
start
()
{
public
void
start
()
{
System
.
out
.
println
(
"------------------------"
);
runRecordingThread
=
new
Thread
(()
->
{
runRecordingThread
=
new
Thread
(()
->
{
dateAligned
(
5000
);
dateAligned
(
5000
);
log
.
info
(
"--------------------【com.byit.thread.RunRecordingScanThread#start】init success----------------------"
);
log
.
info
(
"--------------------【com.byit.thread.RunRecordingScanThread#start】init success----------------------"
);
while
(!
runRecordingThreadStop
)
{
while
(!
runRecordingThreadStop
)
{
dateAligned
(
5000
)
;
boolean
isSleep
=
false
;
Connection
conn
=
null
;
Connection
conn
=
null
;
Boolean
connAutoCommit
=
null
;
Boolean
connAutoCommit
=
null
;
PreparedStatement
preparedStatement
=
null
;
PreparedStatement
preparedStatement
=
null
;
...
@@ -79,8 +78,11 @@ public class RunRecordingScanHelper {
...
@@ -79,8 +78,11 @@ public class RunRecordingScanHelper {
preparedStatement
.
execute
();
preparedStatement
.
execute
();
//进行操作
//进行操作
scanRunRec
();
scanRunRec
();
isSleep
=
true
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
if
(!
runRecordingThreadStop
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
finally
{
}
finally
{
if
(
conn
!=
null
)
{
if
(
conn
!=
null
)
{
try
{
try
{
...
@@ -120,6 +122,10 @@ public class RunRecordingScanHelper {
...
@@ -120,6 +122,10 @@ public class RunRecordingScanHelper {
}
}
}
}
}
}
if
(
isSleep
){
dateAligned
(
20000
);
}
}
}
});
});
runRecordingThread
.
setDaemon
(
true
);
runRecordingThread
.
setDaemon
(
true
);
...
@@ -130,7 +136,6 @@ public class RunRecordingScanHelper {
...
@@ -130,7 +136,6 @@ public class RunRecordingScanHelper {
private
void
scanRunRec
()
{
private
void
scanRunRec
()
{
//查询完结且未告警的工作流信息
//查询完结且未告警的工作流信息
List
<
RunRecording
>
runRecordingByEndAndNotIsAlarm
=
runRecordingService
.
findRunRecordingByEndAndNotIsAlarm
();
List
<
RunRecording
>
runRecordingByEndAndNotIsAlarm
=
runRecordingService
.
findRunRecordingByEndAndNotIsAlarm
();
List
<
EmailAlarm
>
emailAlarms
=
new
ArrayList
<>(
15
);
if
(
CollectionUtil
.
isNotEmpty
(
runRecordingByEndAndNotIsAlarm
))
{
if
(
CollectionUtil
.
isNotEmpty
(
runRecordingByEndAndNotIsAlarm
))
{
runRecordingByEndAndNotIsAlarm
.
forEach
(
runRecording
->
{
runRecordingByEndAndNotIsAlarm
.
forEach
(
runRecording
->
{
//如果设置为完成时告警
//如果设置为完成时告警
...
...
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