diff --git a/src/main/java/com/dreamchaser/depository_manage/utils/AsyncThreadUtil.java b/src/main/java/com/dreamchaser/depository_manage/utils/AsyncThreadUtil.java new file mode 100644 index 00000000..c96003c4 --- /dev/null +++ b/src/main/java/com/dreamchaser/depository_manage/utils/AsyncThreadUtil.java @@ -0,0 +1,38 @@ +package com.dreamchaser.depository_manage.utils; + +import java.util.Random; +import java.util.concurrent.*; + +public class AsyncThreadUtil { + + private ExecutorService executorService = Executors.newCachedThreadPool(); + + /** + * * 使用completionService收集callable结果 + * * @throws ExecutionException + * * @throws InterruptedException + * + */ + public void completionServiceCount() throws InterruptedException, ExecutionException { + // 定义线程池 + + CompletionService completionService = new ExecutorCompletionService( + executorService); + int threadNum = 5; + executorService.shutdown(); + } + + public Callable getTask(final int no) { + final Random rand = new Random(); + Callable task = new Callable() { + @Override + public Integer call() throws Exception { + int time = rand.nextInt(100) * 100; + System.out.println("thead:" + no + " time is:" + time); + Thread.sleep(time); + return no; + } + }; + return task; + } +} diff --git a/target/classes/.restartTriggerFile b/target/classes/.restartTriggerFile new file mode 100644 index 00000000..e69de29b diff --git a/target/classes/templates/pages/materialBarCode/materialBarCode_out.html b/target/classes/templates/pages/materialBarCode/materialBarCode_out.html new file mode 100644 index 00000000..813873d0 --- /dev/null +++ b/target/classes/templates/pages/materialBarCode/materialBarCode_out.html @@ -0,0 +1,282 @@ + + + + + layui + + + + + + + +
+
+ + + + + + +
+ + +
+
+ + + + + \ No newline at end of file