Class ExecutorServiceAdapter
java.lang.Object
java.util.concurrent.AbstractExecutorService
org.springframework.core.task.support.ExecutorServiceAdapter
- All Implemented Interfaces:
Executor,ExecutorService
Adapter that takes a Spring
TaskExecutor
and exposes a full java.util.concurrent.ExecutorService for it.
This is primarily for adapting to client components that communicate via the
java.util.concurrent.ExecutorService API. It can also be used as
common ground between a local Spring TaskExecutor backend and a
JNDI-located ManagedExecutorService in a Jakarta EE environment.
NOTE: This ExecutorService adapter does not support the
lifecycle methods in the java.util.concurrent.ExecutorService API
("shutdown()" etc.), similar to a server-wide ManagedExecutorService
in a Jakarta EE environment. The lifecycle is always up to the backend pool,
with this adapter acting as an access-only proxy for that target pool.
- Since:
- 3.0
- Author:
- Juergen Hoeller
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionExecutorServiceAdapter(TaskExecutor taskExecutor) Create a new ExecutorServiceAdapter, using the given target executor. -
Method Summary
Modifier and TypeMethodDescriptionbooleanawaitTermination(long timeout, TimeUnit unit) voidclose()voidbooleanbooleanvoidshutdown()Methods inherited from class java.util.concurrent.AbstractExecutorService
invokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor, submit, submit, submit
-
Constructor Details
-
ExecutorServiceAdapter
Create a new ExecutorServiceAdapter, using the given target executor.- Parameters:
taskExecutor- the target executor to delegate to
-
-
Method Details
-
execute
-
shutdown
public void shutdown() -
shutdownNow
-
awaitTermination
- Throws:
InterruptedException
-
isShutdown
public boolean isShutdown() -
isTerminated
public boolean isTerminated() -
close
public void close()
-