当前位置:网站首页>CountLaunch Demo的测试
CountLaunch Demo的测试
2022-07-26 04:57:00 【知识浅谈】
public class Test {
//CountLaunch demo 指定6个线程执行完后才能达到条件,继续向下进行
// 处理文件的数量
private static final int threadCount = 6;
public static void main(String[] args) throws InterruptedException {
// 创建一个具有固定线程数量的线程池对象(推荐使用构造方法创建)
ExecutorService threadPool = Executors.newFixedThreadPool(10);
final CountDownLatch countDownLatch = new CountDownLatch(threadCount);
for (int i = 0; i < threadCount; i++) {
final int threadnum = i;
threadPool.execute(() -> {
try {
//处理文件的业务操作
Thread.sleep(2);
//......
} catch (InterruptedException e) {
e.printStackTrace();
} finally {
//表示一个文件已经被完成
countDownLatch.countDown();
}
});
}
countDownLatch.await();
threadPool.shutdown();
System.out.println("finish");
}
}
边栏推荐
- [enterprise micro procedure]
- UE4 switching of control rights of multiple roles
- Spark Structured Streaming HelloWorld
- mongoDB为什么快
- [mathematical modeling] basic knowledge of MATLAB
- Authentication Encyclopedia (cookies, sessions, tokens, JWT, single sign on), in-depth understanding and understanding of authentication
- [uoj 429] runs (inclusive) + a little record about Lyndon tree and its application
- Use field parameters for report translation
- "Game engine light in light out" 4. shader
- An SQL server queries the latest records as of a certain date
猜你喜欢

Offline installation of idea plug-in (continuous update)

Use field parameters for report translation

can 串口 can 232 can 485 串口转CANbus总线网关模块CAN232/485MB转换器CANCOM

二、国际知名项目-HelloWorld
![[300 + selected interview questions from big companies continued to share] big data operation and maintenance sharp knife interview question column (VIII)](/img/a0/b2b0f5fb63301f5b7dd14302aa39e2.png)
[300 + selected interview questions from big companies continued to share] big data operation and maintenance sharp knife interview question column (VIII)

What points should be paid attention to in the selection of project management system?

columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by mysql8.0解决办法

Redis解决库存超卖问题

Phaser(一):平台跳跃收集游戏

minipcie接口CAN卡解决工控机扩展CAN通道的难题 minipcie CAN
随机推荐
C语言——指针一点通※
[mathematical modeling] basic knowledge of MATLAB
[mathematical modeling] analytic hierarchy process (AHP)
Switch and router technology: dynamic routing protocol, rip routing protocol and OSPF routing protocol
Batch convert ppm format pictures to JPG format
Torch slice maintenance
Solve the error string value: '\xf0\x9f\x98\xad',... 'for column' commentcontent 'at row 1
idea插件离线安装(持续更新)
Why is mongodb fast
补位,稍后补上
C language -- string function, memory function collection and Simulation Implementation
Array sort 1
What is the difference between asynchronous and synchronous transmission signals (electronic hardware)
这种是我的vs没连上数据库吗
AXI协议(4):AXI通道上的信号
What points should be paid attention to in the selection of project management system?
Several maturity levels of using MES management system
数据库启动报:ORA-29702: error occurred in Cluster Group Service
Interprocess communication
webassembly 01基本资料