多线程
Theo9
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
线程池
一、java线程池的参数 1. corePoolSize:指定了线程池中的线程数量。 2. maximumPoolSize:指定了线程池中的最大线程数量。 3. keepAliveTime:当前线程池数量超过 corePoolSize 时,多余的空闲线程的存活时间,即多 次时间内会被销毁。 4. unit:keepAliveTime 的单位。 5. wo...原创 2019-11-18 15:09:55 · 232 阅读 · 0 评论 -
十个线程执行1+2+3+4+...+n
问题:十个线程执行1+2+3+4+...+n1、方法一使用volatileimport java.util.concurrent.ExecutorService;import java.util.concurrent.Executors;public class AddNum { public static void main(String[] args) { ...原创 2019-11-16 22:37:08 · 406 阅读 · 0 评论 -
sleep(),wait(),join(),yield(),suspend(),resume()方法
1、sleep()在Thread.class中对其描述为:/** * Causes the currently executing thread to sleep (temporarily cease * execution) for the specified number of milliseconds, subject to * the precisi...原创 2019-09-20 23:54:14 · 472 阅读 · 0 评论
分享