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
b8b78355
Commit
b8b78355
authored
May 12, 2022
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复等待时间
parent
69ff1127
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
10 deletions
+16
-10
BeanDao.java
...util-mq/src/main/java/com/yanzuoguang/mq/dao/BeanDao.java
+16
-10
No files found.
yzg-util-mq/src/main/java/com/yanzuoguang/mq/dao/BeanDao.java
View file @
b8b78355
...
@@ -194,18 +194,24 @@ public class BeanDao {
...
@@ -194,18 +194,24 @@ public class BeanDao {
private
void
timeOut
(
Class
<?>
cls
,
String
name
,
String
message
,
Runnable
runnable
)
{
private
void
timeOut
(
Class
<?>
cls
,
String
name
,
String
message
,
Runnable
runnable
)
{
final
Ref
<
Boolean
>
isRun
=
new
Ref
<>(
false
);
final
Ref
<
Boolean
>
isRun
=
new
Ref
<>(
false
);
ThreadHelper
.
runThread
(()
->
{
ThreadHelper
.
runThread
(()
->
{
long
timeMax
=
1000
;
try
{
int
timeUnit
=
10
;
long
timeMax
=
1000
;
long
start
=
System
.
currentTimeMillis
();
int
timeUnit
=
10
;
do
{
long
start
=
System
.
currentTimeMillis
();
ThreadHelper
.
sleep
(
timeUnit
);
do
{
long
end
=
System
.
currentTimeMillis
();
ThreadHelper
.
sleep
(
timeUnit
);
if
(
end
-
start
>
timeMax
)
{
long
end
=
System
.
currentTimeMillis
();
timeUnit
=
1000
;
if
(
end
-
start
>
timeMax
)
{
Log
.
error
(
cls
,
message
+
name
+
"超时,正在等待执行完成"
);
timeUnit
=
1000
;
Log
.
error
(
cls
,
message
+
name
+
"超时,正在等待执行完成"
);
}
}
}
while
(!
isRun
.
value
);
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
();
}
finally
{
Log
.
info
(
cls
,
message
+
name
+
"完成"
);
}
}
while
(!
isRun
.
value
);
});
});
runnable
.
run
();
runnable
.
run
();
isRun
.
value
=
true
;
isRun
.
value
=
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