Class BlockingRejectedExecutionHandler
- java.lang.Object
-
- com.broadleafcommerce.search.index.core.BlockingRejectedExecutionHandler
-
- All Implemented Interfaces:
RejectedExecutionHandler
public class BlockingRejectedExecutionHandler extends Object implements RejectedExecutionHandler
This is a component to optionally configure a ThreadPoolTaskExecutor. The purpose of this is that, when the task queue is full, rather than rejecting another task, it delegates to the calling thread to execute.Care should be taken as this can cause thread starvation, but the trade-off is that when you have a task executor with a max queue size, it allows you to throttle so that you don't either run out of memory filling an unbounded queue, or get an exception because the queue was full.
- Author:
- Kelly Tisdell (ktisdell)
-
-
Constructor Summary
Constructors Constructor Description BlockingRejectedExecutionHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
rejectedExecution(Runnable runnable, ThreadPoolExecutor executor)
-
-
-
Method Detail
-
rejectedExecution
public void rejectedExecution(Runnable runnable, ThreadPoolExecutor executor)
- Specified by:
rejectedExecution
in interfaceRejectedExecutionHandler
-
-