Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
Y
yzg-util
Project
Project
Details
Activity
Releases
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
YZG
yzg-util
Commits
862f0283
Commit
862f0283
authored
Nov 02, 2021
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改实例化关系
parent
f92e96f4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
7 deletions
+12
-7
CacheLock.java
...-redis/src/main/java/com.yanzuoguang.redis/CacheLock.java
+12
-7
No files found.
yzg-util-redis/src/main/java/com.yanzuoguang.redis/CacheLock.java
View file @
862f0283
...
...
@@ -127,7 +127,7 @@ public class CacheLock implements Runnable {
};
do
{
// 开启唯一性锁,防止多人运行同一关键字的函数
cache
.
tryLockAndRun
(
key
,
lockTime
,
TimeUnit
.
SECONDS
,
runnable
);
cache
.
tryLockAndRun
(
key
,
lockTime
,
TimeUnit
.
MILLI
SECONDS
,
runnable
);
// 假如没有运行,则等待50毫秒后继续运行
if
(!
runFlag
)
{
this
.
waitCount
++;
...
...
@@ -137,13 +137,18 @@ public class CacheLock implements Runnable {
}
private
void
funcRun
()
{
if
(
this
.
waitCount
>
0
&&
this
.
funcWait
!=
null
)
{
funcWait
.
run
();
}
if
(
this
.
func
!=
null
)
{
func
.
run
();
try
{
if
(
this
.
waitCount
>
0
&&
this
.
funcWait
!=
null
)
{
funcWait
.
run
();
}
if
(
this
.
func
!=
null
)
{
func
.
run
();
}
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
();
}
finally
{
runFlag
=
true
;
}
runFlag
=
true
;
}
/**
...
...
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