Package org.aoju.bus.core.thread
Class BlockPolicy
java.lang.Object
org.aoju.bus.core.thread.BlockPolicy
- All Implemented Interfaces:
RejectedExecutionHandler
当任务队列过长时处于阻塞状态,直到添加到队列中,如果阻塞过程中被中断,就会抛出
InterruptedException异常
有时候在线程池内访问第三方接口,只希望固定并发数去访问,并且不希望丢弃任务时使用此策略,队列满的时候会处于阻塞状态(例如刷库的场景)- Since:
- Java 17+
- Author:
- Kimi Liu
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
BlockPolicy
-
BlockPolicy
public BlockPolicy()构造
-
-
Method Details
-
rejectedExecution
- Specified by:
rejectedExecutionin interfaceRejectedExecutionHandler
-