提交 44792216 编写于 作者: 武汉红喜's avatar 武汉红喜

concurrent test

上级 6df276c8
...@@ -13,7 +13,7 @@ import java.util.stream.IntStream; ...@@ -13,7 +13,7 @@ import java.util.stream.IntStream;
public class RunnableTest { public class RunnableTest {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
ExecutorService executorService = Executors.newCachedThreadPool(); ExecutorService executorService = Executors.newFixedThreadPool(3);
IntStream.range(0, 10).forEach(n -> { IntStream.range(0, 10).forEach(n -> {
executorService.execute(() -> System.out.println(n)); executorService.execute(() -> System.out.println(n));
}); });
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册