Commit b7799941 authored by yanzg's avatar yanzg

升级新版本

parent 95d52d47
...@@ -85,6 +85,10 @@ public class YzgTimeout { ...@@ -85,6 +85,10 @@ public class YzgTimeout {
} }
private static void init() { private static void init() {
if (executorService != null) {
return;
}
synchronized (YzgTimeout.class) { synchronized (YzgTimeout.class) {
if (executorService != null) { if (executorService != null) {
return; return;
...@@ -95,8 +99,12 @@ public class YzgTimeout { ...@@ -95,8 +99,12 @@ public class YzgTimeout {
ThreadHelper.runThread(() -> { ThreadHelper.runThread(() -> {
while (true) { while (true) {
runItem(); try {
ThreadHelper.sleep(1000); runItem();
} catch (Exception ex) {
ex.printStackTrace();
}
ThreadHelper.sleep(200);
} }
}); });
} }
...@@ -112,6 +120,9 @@ public class YzgTimeout { ...@@ -112,6 +120,9 @@ public class YzgTimeout {
synchronized (queueInfos) { synchronized (queueInfos) {
poll = queueInfos.poll(); poll = queueInfos.poll();
} }
if (poll == null) {
return;
}
long end = System.currentTimeMillis(); long end = System.currentTimeMillis();
long time = end - poll.getStart(); long time = end - poll.getStart();
if (time > poll.getTimeMax()) { if (time > poll.getTimeMax()) {
......
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