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
de2b0b9b
Commit
de2b0b9b
authored
May 25, 2020
by
huangfusuper
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
分布式锁
parent
445c18e6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
11 deletions
+4
-11
DaemonScanThreadRunHelperRedisLock.java
.../com/byit/factory/DaemonScanThreadRunHelperRedisLock.java
+1
-2
MakeUpFlowThreadRunHelper.java
...ava/com/byit/thread/helper/MakeUpFlowThreadRunHelper.java
+3
-9
No files found.
byit-myth-core/myth-admin-core/src/main/java/com/byit/factory/DaemonScanThreadRunHelperRedisLock.java
View file @
de2b0b9b
...
@@ -42,8 +42,7 @@ public class DaemonScanThreadRunHelperRedisLock extends BaseDaemonScanThreadRunH
...
@@ -42,8 +42,7 @@ public class DaemonScanThreadRunHelperRedisLock extends BaseDaemonScanThreadRunH
Long
sleepTime
=
0L
;
Long
sleepTime
=
0L
;
try
{
try
{
//加锁 60秒后超时
//加锁 60秒后超时
boolean
trlock
=
RedissLockUtil
.
trlock
(
lockName
,
TimeUnit
.
SECONDS
,
1
);
if
(
RedissLockUtil
.
trlock
(
lockName
,
TimeUnit
.
SECONDS
,
1
))
{
if
(
trlock
)
{
log
.
debug
(
"------------{},加锁成功,锁名称为{}----------"
,
threadName
,
lockName
);
log
.
debug
(
"------------{},加锁成功,锁名称为{}----------"
,
threadName
,
lockName
);
dateAligned
(
CYCLE_INTERVAL
,
threadName
);
dateAligned
(
CYCLE_INTERVAL
,
threadName
);
//调用业务操作
//调用业务操作
...
...
byit-myth-core/myth-admin-core/src/main/java/com/byit/thread/helper/MakeUpFlowThreadRunHelper.java
View file @
de2b0b9b
...
@@ -57,21 +57,15 @@ public class MakeUpFlowThreadRunHelper extends BaseThreadRunHelper {
...
@@ -57,21 +57,15 @@ public class MakeUpFlowThreadRunHelper extends BaseThreadRunHelper {
*/
*/
Map
<
Integer
,
WaitingRecord
>
nextRunFlow
=
allByTriggerTime
.
stream
()
Map
<
Integer
,
WaitingRecord
>
nextRunFlow
=
allByTriggerTime
.
stream
()
.
collect
(
Collectors
.
toMap
(
WaitingRecord:
:
getFlowId
,
Function
.
identity
(),
BinaryOperator
.
minBy
(
Comparator
.
comparingInt
(
WaitingRecord:
:
getWaitOrder
))));
.
collect
(
Collectors
.
toMap
(
WaitingRecord:
:
getFlowId
,
Function
.
identity
(),
BinaryOperator
.
minBy
(
Comparator
.
comparingInt
(
WaitingRecord:
:
getWaitOrder
))));
Random
random
=
new
Random
();
nextRunFlow
.
forEach
((
key
,
value
)
->{
for
(
WaitingRecord
value
:
nextRunFlow
.
values
())
{
/*保证数据为串行*/
try
{
Thread
.
sleep
(
random
.
nextInt
(
101
)+
100
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
boolean
runRecordingIsRunning
=
runRecordingService
.
findRunRecordingIsRunning
(
value
.
getFlowId
());
boolean
runRecordingIsRunning
=
runRecordingService
.
findRunRecordingIsRunning
(
value
.
getFlowId
());
log
.
info
(
"-------{}的运行状态为{}"
,
value
,
runRecordingIsRunning
);
log
.
info
(
"-------{}的运行状态为{}"
,
value
,
runRecordingIsRunning
);
log
.
info
(
"==================================================的运行状态为{}======================================"
,
runRecordingIsRunning
);
log
.
info
(
"==================================================的运行状态为{}======================================"
,
runRecordingIsRunning
);
if
(!
runRecordingIsRunning
){
if
(!
runRecordingIsRunning
){
runRecordingAndJobTaskService
.
updateRunRecordingAndTask
(
value
);
runRecordingAndJobTaskService
.
updateRunRecordingAndTask
(
value
);
}
}
}
);
}
return
UNIVERSAL_WAIT_TIME
;
return
UNIVERSAL_WAIT_TIME
;
}
}
...
...
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