public class ThrottledExecutor extends Object implements Executor
Asynchronous methods. Without a throttling
mechanism, Asynchronous methods can cause too many threads to
execute or starve other activities.| Constructor and Description |
|---|
ThrottledExecutor(int permits,
int maxQueued) |
| Modifier and Type | Method and Description |
|---|---|
void |
execute(Runnable command)
Queues the command for later execution, or executes it immediately.
|
public ThrottledExecutor(int permits,
int maxQueued)
permits - maximum number of threads allowed to execute commands concurrentlymaxQueued - maximum number of queued commands allowed before rejecting new onespublic void execute(Runnable command) throws RejectedExecutionException
execute in interface ExecutorRejectedExecutionException - if too many commands are queuedCopyright © 2006–2015 Cojen. All rights reserved.