一、Java中的ThreadPoolExecutor类

java.uitl.concurrent.ThreadPoolExecutor类是线程池中最核心的一个类,因此如果要透彻地了解Java中的线程池,必须先了解这个类。下面我们来看一下ThreadPoolExecutor类的具体实现源码。
在ThreadPoolExecutor类中提供了四个构造方法:

 1 public class ThreadPoolExecutor extends AbstractExecutorService {
 2     .....
 3     public ThreadPoolExecutor(int corePoolSize,int maximumPoolSize,long keepAliveTime,TimeUnit unit,
 4             BlockingQueue<Runnable> workQueue);
 5  
 6     public ThreadPoolExecutor(int corePoolSize,int maximumPoolSize,long keepAliveTime,TimeUnit unit,
 7             BlockingQueue<Runnable> workQueue,ThreadFactory threadFactory);
 8  
 9     public ThreadPoolExecutor(int corePoolSize,int maximumPoolSize,long keepAliveTime,TimeUnit unit,
10             BlockingQueue<Runnable> workQueue,RejectedExecutionHandler handler);
11  
12     public ThreadPoolExecutor(int corePoolSize,int maximumPoolSize,long keepAliveTime,TimeUnit unit,
13         BlockingQueue<Runnable> workQueue,ThreadFactory threadFactory,RejectedExecutionHandler handler);
14     ...
15 }
View Code

相关文章:

  • 2022-12-23
  • 2022-02-26
  • 2022-02-01
  • 2022-03-01
  • 2021-06-18
猜你喜欢
  • 2022-03-04
  • 2022-12-23
  • 2022-12-23
  • 2021-12-01
  • 2021-06-07
相关资源
相似解决方案