public class CallerBlocksPolicy extends Object implements RejectedExecutionHandler
RejectedExecutionHandler
that blocks the caller until
the executor has room in its queue, or a timeout occurs (in which
case a RejectedExecutionException
is thrown.Constructor and Description |
---|
CallerBlocksPolicy(long maxWait)
Construct instance based on the provided maximum wait time.
|
Modifier and Type | Method and Description |
---|---|
void |
rejectedExecution(Runnable r,
ThreadPoolExecutor executor) |
public CallerBlocksPolicy(long maxWait)
maxWait
- The maximum time to wait for a queue slot to be available, in milliseconds.public void rejectedExecution(Runnable r, ThreadPoolExecutor executor)
rejectedExecution
in interface RejectedExecutionHandler