Java带参数的线程类ParameterizedThread(2)

ThreadPoolExecutor executor = new ThreadPoolExecutor(6, 10, 5, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>());
for (int i = 0; i < 100; i++) {
    executor.execute(new ParameterizedThread<>(i, (p) -> {
        System.out.println(p.toString());
    }));
}

Linux公社的RSS地址:https://www.linuxidc.com/rssFeed.aspx

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/55c6e1e73fe7cfcc1afd03d68c6c5de3.html