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
ccbbccb2
Commit
ccbbccb2
authored
May 14, 2022
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复等待时间
parent
a12d4b9e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
+8
-7
YzgTimeout.java
...src/main/java/com/yanzuoguang/util/helper/YzgTimeout.java
+8
-7
No files found.
yzg-util-base/src/main/java/com/yanzuoguang/util/helper/YzgTimeout.java
View file @
ccbbccb2
...
@@ -11,8 +11,9 @@ import com.yanzuoguang.util.vo.Ref;
...
@@ -11,8 +11,9 @@ import com.yanzuoguang.util.vo.Ref;
*/
*/
public
class
YzgTimeout
{
public
class
YzgTimeout
{
public
static
final
long
TIME_OUT_DEFAULT
=
5000
;
public
static
final
long
TIME_OUT_DEFAULT
=
15
*
1000
;
public
static
final
int
TIME_OUT_TIP
=
1000
;
public
static
final
int
TIME_OUT_TIP
=
10
*
1000
;
public
static
final
int
TIME_OUT_UNIT
=
10
;
/**
/**
* 超时监控
* 超时监控
...
@@ -26,14 +27,14 @@ public class YzgTimeout {
...
@@ -26,14 +27,14 @@ public class YzgTimeout {
ThreadHelper
.
runThread
(()
->
{
ThreadHelper
.
runThread
(()
->
{
try
{
try
{
long
timeMax
=
TIME_OUT_DEFAULT
;
long
timeMax
=
TIME_OUT_DEFAULT
;
int
timeUnit
=
10
;
long
start
=
System
.
currentTimeMillis
();
long
start
=
System
.
currentTimeMillis
();
do
{
do
{
ThreadHelper
.
sleep
(
timeUnit
);
ThreadHelper
.
sleep
(
TIME_OUT_UNIT
);
long
end
=
System
.
currentTimeMillis
();
long
end
=
System
.
currentTimeMillis
();
if
(
end
-
start
>
timeMax
)
{
long
time
=
end
-
start
;
timeUnit
=
TIME_OUT_TIP
;
if
(
time
>
timeMax
)
{
Log
.
error
(
cls
,
message
+
"超时,正在等待执行完成"
);
timeMax
+=
TIME_OUT_TIP
;
Log
.
error
(
cls
,
"%s超时,已经执行%d豪秒,正在等待执行完成"
,
message
,
time
);
}
}
}
while
(!
isRun
.
value
);
}
while
(!
isRun
.
value
);
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
...
...
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