Commit ccbbccb2 authored by yanzg's avatar yanzg

修复等待时间

parent a12d4b9e
...@@ -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) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment