public final class DefaultEventExecutor extends Object implements EventExecutor
Constructor and Description |
---|
DefaultEventExecutor(ThreadFactory threadFactory,
int pendingTasksCapacity) |
Modifier and Type | Method and Description |
---|---|
<T> CompletableFuture<T> |
schedule(Callable<T> task,
long delay,
TimeUnit unit)
Submits a task for delayed execution.
|
CompletableFuture<Void> |
schedule(Runnable task,
long delay,
TimeUnit unit)
Submits a task for delayed execution.
|
CompletableFuture<Void> |
shutdown()
Shuts down the event executor.
|
<T> CompletableFuture<T> |
submit(Callable<T> task)
Submits a task for immediate execution.
|
CompletableFuture<Void> |
submit(Runnable task)
Submits a task for immediate execution.
|
public DefaultEventExecutor(ThreadFactory threadFactory, int pendingTasksCapacity)
public CompletableFuture<Void> submit(Runnable task)
EventExecutor
submit
in interface EventExecutor
task
- runnable to executepublic <T> CompletableFuture<T> submit(Callable<T> task)
EventExecutor
submit
in interface EventExecutor
task
- callable to executepublic CompletableFuture<Void> schedule(Runnable task, long delay, TimeUnit unit)
EventExecutor
schedule
in interface EventExecutor
task
- runnable to executedelay
- the time from now to delay executionunit
- the time unit of the delay parameterpublic <T> CompletableFuture<T> schedule(Callable<T> task, long delay, TimeUnit unit)
EventExecutor
schedule
in interface EventExecutor
task
- runnable to executedelay
- the time from now to delay executionunit
- the time unit of the delay parameterpublic CompletableFuture<Void> shutdown()
EventExecutor
No additional task will be accepted by the submit and schedule methods. Both methods will throw a RejectedExecutionException after this method is called.
All scheduled tasks that have not expired will not be executed by the event executor.
shutdown
in interface EventExecutor