Reputation: 2580
Why do we need AsyncTaskExecutor
(and it's implementations, i.e. SimpleAsyncTaskExecutor
), when Java offers those already (through Executors
)?
Upvotes: 2
Views: 108
Reputation: 49646
TaskExecutor
is basically a Spring abstraction over the standard JDK's Executor
.
Equivalent to JDK 1.5's
java.util.concurrent.Executor
interface; extending it now in Spring 3.0, so that clients may declare a dependency on anExecutor
and receive anyTaskExecutor
implementation.
Spring guys build own ecosystem and care how it can coexist with the standard JDK means. Usually, these implementations are more competitive, API-richer and Spring-orientated (actively used within the Spring Framework itself).
Upvotes: 3
Reputation: 16039
SimpleAsyncTaskExecutor
is an implementation of AsyncTaskExecutor
, which is by default used when running @Async
methods. You can however provide your own TaskExecutor
to be used instead of the default one. The reason why Spring does it is to give you more flexibility.
Upvotes: 2