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,17 +89,20 @@ public class YzgTimeout { ...@@ -89,17 +89,20 @@ public class YzgTimeout {
private static void init() { private static void init() {
synchronized (YzgTimeout.class) { synchronized (YzgTimeout.class) {
if (executorService == null) { if (executorService != null) {
executorService = new ThreadPoolExecutor(1, 10, 1000, return;
TimeUnit.MILLISECONDS, new ArrayBlockingQueue<>(10));
} }
executorService = new ThreadPoolExecutor(1, 10, 1000,
TimeUnit.MILLISECONDS, new ArrayBlockingQueue<>(10));
ThreadHelper.runThread(() -> {
while (true) {
runItem();
ThreadHelper.sleep(1000);
}
});
} }
ThreadHelper.runThread(() -> {
while (true) {
runItem();
ThreadHelper.sleep(1000);
}
});
} }
private static void runItem() { private static void runItem() {
......
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