当前位置:网站首页>Thread,Runnable,ExecutorService线程池控制下线程量
Thread,Runnable,ExecutorService线程池控制下线程量
2022-08-09 09:28:00 【潇湘梦】
Thread线程池简单手工搞一波写个理解下
public class Souprint extends Thread implements Runnable {
private Integer sysPint;
public Souprint(Integer pint) {
this.sysPint = pint;
}
@Override
public void run() {
try {
System.out.println("参数:"+sysPint + "线程打印 ThreadName:"+Thread.currentThread().getName()+" ID:"+Thread.currentThread().getId());
Thread.sleep(3);
System.out.println("休眠后 线程打印 ThreadName:"+Thread.currentThread().getName()+" ID:"+Thread.currentThread().getId());
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
@Test
public void testThead() {
//创建一个线程池
ExecutorService exe = Executors.newFixedThreadPool(4);
String[] str = new String[]{
"1", "2", "3", "4"};
for (String s : str) {
int sssss = Integer.parseInt(s);
System.out.println(sssss);
exe.execute(new Thread(new Souprint(sssss)));
}
exe.shutdown();
}
边栏推荐
- What are the basic concepts of performance testing?What knowledge do you need to master to perform performance testing?
- 测试计划包括哪些内容?目的和意义是什么?
- web测试之功能测试常用的方法有哪几种?有什么要点要注意?
- Understanding of PID control motor output as motor PWM duty cycle input
- 本体开发日记01-Jena配置环境变量
- 4.字符流
- 接口开发规范及测试工具的使用
- 图表示学习(Graph Representation Learning)笔记
- A Practical Guide to Building OWL Ontologies using Protege4 and CO-ODE Tools - Version 1.3 (7.4 Annotation Properties - Annotation Properties)
- RPC服务远程漏洞
猜你喜欢

Ontology Development Diary 01-Jena Configuration Environment Variables

接口测试的概念、目的、流程、测试方法有哪些?
软件测试面试常见问题及答案(发散思维、接口、性能、概念、)

China to create a domestic "Google Earth" clarity scary

记录一次被入侵5900端口经历

命令行查询数据库

.ts 音频文件转换成 .mp3 文件

Another implementation of lateral view explode

白盒测试的概念、目的是什么?及主要方法有哪些?
软件测试面试题目:请你列举几个物品的测试方法怎么说?
随机推荐
选择黑盒测试用例设计方法的综合策略方案总结
3.编码方式
Domestic with Google earth software, see the download 19th level high-resolution satellite images so easy!
类 对象 属性 方法 类的成员
Summary of steps and methods for installing and uninstalling test cases that you must read
接口测试的基础流程和用例设计方法你知道吗?
6.File类
迭代
7.FileFilter interface
第四讲 SVN
MySQL Leak Detection and Filling (2) Sorting and Retrieval, Filtering Data, Fuzzy Query, Regular Expression
使用Protege4和CO-ODE工具构建OWL本体的实用指南-1.3版本(4.Building An OWL Ontology)
[Personal study summary] CRC verification principle and implementation
使用Protege4和CO-ODE工具构建OWL本体的实用指南-1.3版本(7.4 Annotation Properties-注释属性)
7.Collections tool class
可以写进简历的软件测试项目实战经验(包含电商、银行、app等)
seata处理分布式事务
2. Byte stream
一个项目的整体测试流程有哪几个阶段?测试方法有哪些?
5. Transform Streams