org.springframework.scheduling.concurrent |
Scheduling convenience classes for the JDK 1.5+ Executor mechanism
in the java.util.concurrent package, allowing to set
up a ThreadPoolExecutor or ScheduledThreadPoolExecutor as bean in
a Spring context.
|
Java Source File Name | Type | Comment |
ConcurrentTaskExecutor.java | Class | Adapter that takes a JDK 1.5 java.util.concurrent.Executor and
exposes a Spring
org.springframework.core.task.TaskExecutor for it.
NOTE: This class implements Spring's
org.springframework.core.task.TaskExecutor interface as well as the JDK 1.5
java.util.concurrent.Executor interface, with the former being the primary
interface, the other just serving as secondary convenience. |
CustomizableThreadFactory.java | Class | Implementation of the JDK 1.5
java.util.concurrent.ThreadFactory interface, allowing for customizing the created threads (name, priority, etc). |
ScheduledExecutorFactoryBean.java | Class | org.springframework.beans.factory.FactoryBean that sets up
a JDK 1.5
java.util.concurrent.ScheduledExecutorService (by default:
java.util.concurrent.ScheduledThreadPoolExecutor as implementation) and exposes it for bean references.
Allows for registration of
ScheduledExecutorTask ScheduledExecutorTasks ,
automatically starting the
ScheduledExecutorService on initialization and
cancelling it on destruction of the context. |
ScheduledExecutorTask.java | Class | JavaBean that describes a scheduled executor task, consisting of the
Runnable and a delay plus period. |
ThreadPoolTaskExecutor.java | Class | JavaBean that allows for configuring a JDK 1.5
java.util.concurrent.ThreadPoolExecutor in bean style (through its "corePoolSize", "maxPoolSize", "keepAliveSeconds", "queueCapacity"
properties), exposing it as a Spring
org.springframework.core.task.TaskExecutor .
This is an alternative to configuring a ThreadPoolExecutor instance directly using
constructor injection, with a separate
ConcurrentTaskExecutor adapter wrapping it.
For any custom needs, in particular for defining a
java.util.concurrent.ScheduledThreadPoolExecutor , it is recommended to
use a straight definition of the Executor instance or a factory method definition
that points to the JDK 1.5
java.util.concurrent.Executors class.
To expose such a raw Executor as a Spring
org.springframework.core.task.TaskExecutor ,
simply wrap it with a
ConcurrentTaskExecutor adapter.
NOTE: This class implements Spring's
org.springframework.core.task.TaskExecutor interface as well as the JDK 1.5
java.util.concurrent.Executor interface, with the former being the primary
interface, the other just serving as secondary convenience. |