Interface SimpleScheduledExecutor
-
- All Known Implementing Classes:
DelegatingSimpleScheduledExecutor
@Incubating public interface SimpleScheduledExecutor
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description booleanisBlocking()default Future<?>offer(Runnable task)Makes an attempt to submit ataskfor execution.ScheduledFuture<?>schedule(Runnable command, long delay, TimeUnit unit)Submits a task that becomes enabled after the given delay.voidshutdownNow()Attempts to stop all actively executing tasks, halts the processing of waiting tasks.Future<?>submit(Runnable task)
-
-
-
Method Detail
-
submit
Future<?> submit(Runnable task)
- Parameters:
task- the task to submit- Returns:
- a
Futurerepresenting pending completion of the task - Throws:
RejectedExecutionException- if the task cannot be scheduled for execution
-
schedule
ScheduledFuture<?> schedule(Runnable command, long delay, TimeUnit unit)
Submits a task that becomes enabled after the given delay.- Parameters:
command- the task to executedelay- the time from now to delay executionunit- the time unit of the delay parameter- Returns:
- a
ScheduledFuturerepresenting pending completion of the submitted task. - Throws:
RejectedExecutionException- if the task cannot be scheduled for execution
-
offer
default Future<?> offer(Runnable task)
Makes an attempt to submit ataskfor execution. If the attempt is successful - returns aFuturerepresenting that task. Otherwise, in case submitting a task would result in blocking - task is not submitted and anexceptionis thrown.- Parameters:
task- the task to submit- Returns:
- a
Futurerepresenting 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
void shutdownNow()
Attempts to stop all actively executing tasks, halts the processing of waiting tasks.
-
isBlocking
boolean isBlocking()
- Returns:
trueif this executor may block when a task is submitted to it;falseif it never block (e.g. throws anRejectedExecutionException).
-
-