public interface Worker
| Modifier and Type | Method and Description |
|---|---|
void |
executeBlockingIO(@NotNull Runnable task)
Performs the given task inline, and increase available threads in the pool
by one for the execution of other tasks.
|
<T> @NotNull Future<T> |
submit(@NotNull Callable<T> task)
Submits a value-returning task for execution and returns a
Future representing the pending results of the task.
|
@NotNull Future<?> |
submit(@NotNull Runnable task)
Submits a Runnable task for execution and returns a Future
representing that task.
|
<T> @NotNull Future<T> |
submit(@NotNull Runnable task,
T result)
Submits a Runnable task for execution and returns a Future
representing that task.
|
void executeBlockingIO(@NotNull
@NotNull Runnable task)
It is imperative to wrap all I/O tasks in this method to prevent starving other parsing tasks from threads.
task - the I/O blocking task to executeNullPointerException - if the task is null@NotNull <T> @NotNull Future<T> submit(@NotNull @NotNull Callable<T> task)
get method will return the task's result upon
successful completion.
result = exec.submit(aCallable).get();
Note: The Executors class includes a set of methods
that can convert some other common closure-like objects,
for example, PrivilegedAction to
Callable form so they can be submitted.
T - the type of the task's resulttask - the task to submitRejectedExecutionException - if the task cannot be
scheduled for executionNullPointerException - if the task is null@NotNull <T> @NotNull Future<T> submit(@NotNull @NotNull Runnable task, T result)
get method will
return the given result upon successful completion.T - the type of the resulttask - the task to submitresult - the result to returnRejectedExecutionException - if the task cannot be
scheduled for executionNullPointerException - if the task is null@NotNull @NotNull Future<?> submit(@NotNull @NotNull Runnable task)
get method will
return null upon successful completion.task - the task to submitRejectedExecutionException - if the task cannot be
scheduled for executionNullPointerException - if the task is nullCopyright © 2019. All rights reserved.