public class BlockPolicy extends Object implements RejectedExecutionHandler
InterruptedException异常| 限定符和类型 | 字段和说明 |
|---|---|
private java.util.function.Consumer<Runnable> |
handlerWhenShutdown
线程池关闭时,为避免任务丢失,留下处理方法
如果需要由调用方来运行,可以
new BlockPolicy(Runnable::run) |
| 构造器和说明 |
|---|
BlockPolicy()
构造
|
BlockPolicy(java.util.function.Consumer<Runnable> handlerWhenShutdown)
构造
|
private final java.util.function.Consumer<Runnable> handlerWhenShutdown
new BlockPolicy(Runnable::run)public BlockPolicy(java.util.function.Consumer<Runnable> handlerWhenShutdown)
handlerWhenShutdown - 线程池关闭后的执行策略public BlockPolicy()
public void rejectedExecution(Runnable r, ThreadPoolExecutor e)
rejectedExecution 在接口中 RejectedExecutionHandlerCopyright © 2024. All rights reserved.