Reputation: 6399
What is the purpose of TaskExecutor in spring. What problem does it solve ? How is it different from Executors in java concurrent package ?
Upvotes: 3
Views: 3544
Reputation: 64632
It's an interface whose implementations wrap around Java 5+ ExecutorService
and provide implementations for previous versions of Java that are missing the package java.util.concurrent
Upvotes: 1
Reputation: 13380
From http://static.springsource.org/spring/docs/2.0.8/reference/scheduling.html
23.4. The Spring TaskExecutor abstraction
...
Spring's TaskExecutor interface is identical to the java.util.concurrent.Executor interface. In fact, its primary reason for existence is to abstract away the need for Java 5 when using thread pools. The interface has a single method execute(Runnable task) that accepts a task for execution based on the semantics and configuration of the thread pool.
...
Upvotes: 7