public class AbortPolicyWithReport extends ThreadPoolExecutor.AbortPolicy implements XRejectedExecutionHandler
CallerRunsPolicy
策略的原因是线程池会阻塞主线程执行任务,不太合适。| Constructor and Description |
|---|
AbortPolicyWithReport(String name) |
| Modifier and Type | Method and Description |
|---|---|
long |
rejected()
The number of rejected executions.
|
void |
rejectedExecution(Runnable r,
ThreadPoolExecutor e) |
public AbortPolicyWithReport(String name)
public void rejectedExecution(Runnable r, ThreadPoolExecutor e)
rejectedExecution in interface RejectedExecutionHandlerrejectedExecution in class ThreadPoolExecutor.AbortPolicypublic long rejected()
XRejectedExecutionHandlerrejected in interface XRejectedExecutionHandlerCopyright © 2022. All rights reserved.