Commit cf736279 authored by yanzg's avatar yanzg

Merge branch 'ver1.1' of http://192.168.0.204/yzg/yzg-util

parents 9edb0efa 65cc655b
...@@ -89,11 +89,13 @@ public class YzgTimeout { ...@@ -89,11 +89,13 @@ public class YzgTimeout {
private static void init() { private static void init() {
synchronized (YzgTimeout.class) { synchronized (YzgTimeout.class) {
if (executorService == null) { if (executorService != null) {
return;
}
executorService = new ThreadPoolExecutor(1, 10, 1000, executorService = new ThreadPoolExecutor(1, 10, 1000,
TimeUnit.MILLISECONDS, new ArrayBlockingQueue<>(10)); TimeUnit.MILLISECONDS, new ArrayBlockingQueue<>(10));
}
}
ThreadHelper.runThread(() -> { ThreadHelper.runThread(() -> {
while (true) { while (true) {
runItem(); runItem();
...@@ -101,6 +103,7 @@ public class YzgTimeout { ...@@ -101,6 +103,7 @@ public class YzgTimeout {
} }
}); });
} }
}
private static void runItem() { private static void runItem() {
int size = queueInfos.size(); int size = queueInfos.size();
......
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