Makes an attempt to submit a task for execution. If the attempt is successful - returns
a Future representing that task. Otherwise, in case submitting a task would result in blocking -
task is not submitted and an exception is thrown.
Parameters:
task - the task to submit
Returns:
a Future representing pending completion of the task
Throws:
RejectedExecutionException - if the task cannot be scheduled for execution, or doing so would result in blocking the tread.
shutdownNow
voidshutdownNow()
Attempts to stop all actively executing tasks, halts the processing of waiting tasks.
isBlocking
booleanisBlocking()
Returns:
true if this executor may block when a task is submitted to it;
false if it never block (e.g. throws an RejectedExecutionException).