public class DynamicThreadPoolWrapper extends Object implements org.springframework.beans.factory.DisposableBean
| 构造器和说明 |
|---|
DynamicThreadPoolWrapper(String threadPoolId) |
DynamicThreadPoolWrapper(String threadPoolId,
ThreadPoolExecutor threadPoolExecutor) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
destroy() |
void |
execute(Runnable command)
Executes the given task sometime in the future.
|
<T> Future<T> |
submit(Callable<T> task)
Submits a value-returning task for execution and returns a
Future representing the pending results of the task.
|
Future<?> |
submit(Runnable task)
Submits a Runnable task for execution and returns a Future
representing that task.
|
public DynamicThreadPoolWrapper(String threadPoolId)
public DynamicThreadPoolWrapper(String threadPoolId, ThreadPoolExecutor threadPoolExecutor)
public void execute(Runnable command)
If the task cannot be submitted for execution, either because this
executor has been shutdown or because its capacity has been reached,
the task is handled by the current RejectedExecutionHandler.
command - the task to executeRejectedExecutionException - at discretion of
RejectedExecutionHandler, if the task
cannot be accepted for executionNullPointerException - if command is nullpublic Future<?> submit(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 nullpublic <T> Future<T> submit(Callable<T> task)
get method will return the task's result upon
successful completion.
If you would like to immediately block waiting
for a task, you can use constructions of the form
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 nullCopyright © 2022. All rights reserved.