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
445c18e6
Commit
445c18e6
authored
May 25, 2020
by
huangfusuper
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
分布式锁
parent
500723e1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
2 deletions
+3
-2
RedissonProperties.java
...ain/java/com/byit/conf/properties/RedissonProperties.java
+1
-1
DaemonScanThreadRunHelperRedisLock.java
.../com/byit/factory/DaemonScanThreadRunHelperRedisLock.java
+2
-1
No files found.
byit-myth-core/myth-admin-core/src/main/java/com/byit/conf/properties/RedissonProperties.java
View file @
445c18e6
...
@@ -14,7 +14,7 @@ import java.util.List;
...
@@ -14,7 +14,7 @@ import java.util.List;
public
class
RedissonProperties
{
public
class
RedissonProperties
{
private
int
timeout
=
60
000
;
private
int
timeout
=
3
000
;
private
String
address
;
private
String
address
;
...
...
byit-myth-core/myth-admin-core/src/main/java/com/byit/factory/DaemonScanThreadRunHelperRedisLock.java
View file @
445c18e6
...
@@ -8,6 +8,7 @@ import org.springframework.stereotype.Component;
...
@@ -8,6 +8,7 @@ import org.springframework.stereotype.Component;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.Set
;
import
java.util.concurrent.TimeUnit
;
/**
/**
* 使用redis分布式锁
* 使用redis分布式锁
...
@@ -41,7 +42,7 @@ public class DaemonScanThreadRunHelperRedisLock extends BaseDaemonScanThreadRunH
...
@@ -41,7 +42,7 @@ public class DaemonScanThreadRunHelperRedisLock extends BaseDaemonScanThreadRunH
Long
sleepTime
=
0L
;
Long
sleepTime
=
0L
;
try
{
try
{
//加锁 60秒后超时
//加锁 60秒后超时
boolean
trlock
=
RedissLockUtil
.
trlock
(
lockName
,
60
);
boolean
trlock
=
RedissLockUtil
.
trlock
(
lockName
,
TimeUnit
.
SECONDS
,
1
);
if
(
trlock
)
{
if
(
trlock
)
{
log
.
debug
(
"------------{},加锁成功,锁名称为{}----------"
,
threadName
,
lockName
);
log
.
debug
(
"------------{},加锁成功,锁名称为{}----------"
,
threadName
,
lockName
);
dateAligned
(
CYCLE_INTERVAL
,
threadName
);
dateAligned
(
CYCLE_INTERVAL
,
threadName
);
...
...
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