0
点赞
收藏
分享

微信扫一扫

☆技术问答集锦(14)ThreadPoolExecutor

1 ThreadPoolExecutor构造器参数有哪些?分别什么含义

public ThreadPoolExecutor(int corePoolSize,
                          int maximumPoolSize,
                          long keepAliveTime,
                          TimeUnit unit,
                          BlockingQueue<Runnable> workQueue,
                          ThreadFactory threadFactory,
                          RejectedExecutionHandler handler)

2 ThreadPoolExecutor线程创建策略?

3 ThreadPoolExecutor拒绝策略有哪些?

4 ThreadPoolExecutor参数中ThreadFactory有哪些实现类?

5 FactoryPattern意义,其要解决什么问题?

6 ThreadPoolExecutor里有三个钩子方法,分别什么作用?

// 任务执行前调用
protected void beforeExecute(Thread t, Runnable r) { }

// 任务结束后调用
protected void afterExecute(Runnable r, Throwable t) { }

// Executor终止前调用
protected void terminated() { }
举报

相关推荐

0 条评论