|
spring-context | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.scheduling.timer.TimerTaskExecutor
scheduling.concurrent
package which is based on Java 5's java.util.concurrent.ExecutorService
@Deprecated public class TimerTaskExecutor
TaskExecutor
implementation that uses a
single Timer
for executing all tasks, effectively resulting in
serialized asynchronous execution on a single thread.
Timer
Field Summary | |
---|---|
protected org.apache.commons.logging.Log |
logger
Deprecated. |
Fields inherited from interface org.springframework.core.task.AsyncTaskExecutor |
---|
TIMEOUT_IMMEDIATE, TIMEOUT_INDEFINITE |
Constructor Summary | |
---|---|
TimerTaskExecutor()
Deprecated. Create a new TimerTaskExecutor that needs to be further configured and initialized. |
|
TimerTaskExecutor(java.util.Timer timer)
Deprecated. Create a new TimerTaskExecutor for the given Timer . |
Method Summary | ||
---|---|---|
void |
afterPropertiesSet()
Deprecated. |
|
protected java.util.Timer |
createTimer()
Deprecated. Create a new Timer instance. |
|
void |
destroy()
Deprecated. Cancel the Timer on bean factory shutdown, stopping all scheduled tasks. |
|
void |
execute(java.lang.Runnable task)
Deprecated. Schedules the given Runnable on this executor's Timer instance,
wrapping it in a DelegatingTimerTask . |
|
void |
execute(java.lang.Runnable task,
long startTimeout)
Deprecated. |
|
protected java.util.Timer |
getTimer()
Deprecated. Return the underlying Timer behind this TimerTaskExecutor. |
|
boolean |
prefersShortLivedTasks()
Deprecated. This task executor prefers short-lived work units. |
|
void |
setBeanName(java.lang.String beanName)
Deprecated. |
|
void |
setDelay(long delay)
Deprecated. Set the delay to use for scheduling tasks passed into the plain execute(Runnable) method. |
|
void |
setTimer(java.util.Timer timer)
Deprecated. Set the Timer to use for this TimerTaskExecutor , for example
a shared Timer instance defined by a TimerFactoryBean . |
|
|
submit(java.util.concurrent.Callable<T> task)
Deprecated. |
|
java.util.concurrent.Future<?> |
submit(java.lang.Runnable task)
Deprecated. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final org.apache.commons.logging.Log logger
Constructor Detail |
---|
public TimerTaskExecutor()
setTimer(java.util.Timer)
,
afterPropertiesSet()
public TimerTaskExecutor(java.util.Timer timer)
Timer
.
timer
- the Timer
to wrapMethod Detail |
---|
public void setTimer(java.util.Timer timer)
Timer
to use for this TimerTaskExecutor
, for example
a shared Timer
instance defined by a TimerFactoryBean
.
If not specified, a default internal Timer
instance will be used.
timer
- the Timer
to use for this TimerTaskExecutor
TimerFactoryBean
public void setDelay(long delay)
execute(Runnable)
method. Default is 0.
Note that calls to execute(Runnable, long)
will use the
given timeout as delay if it is lower than the general delay.
delay
- the delay in milliseconds before the task is to be executedpublic void setBeanName(java.lang.String beanName)
setBeanName
in interface org.springframework.beans.factory.BeanNameAware
public void afterPropertiesSet()
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
protected java.util.Timer createTimer()
Timer
instance. Called by afterPropertiesSet
if no Timer
has been specified explicitly.
The default implementation creates a plain non-daemon Timer
.
If overridden, subclasses must take care to ensure that a non-null
Timer
is returned from the execution of this method.
afterPropertiesSet()
,
Timer.Timer(String, boolean)
protected final java.util.Timer getTimer()
public void execute(java.lang.Runnable task)
Runnable
on this executor's Timer
instance,
wrapping it in a DelegatingTimerTask
.
execute
in interface java.util.concurrent.Executor
execute
in interface org.springframework.core.task.TaskExecutor
task
- the task to be executedpublic void execute(java.lang.Runnable task, long startTimeout)
execute
in interface org.springframework.core.task.AsyncTaskExecutor
public java.util.concurrent.Future<?> submit(java.lang.Runnable task)
submit
in interface org.springframework.core.task.AsyncTaskExecutor
public <T> java.util.concurrent.Future<T> submit(java.util.concurrent.Callable<T> task)
submit
in interface org.springframework.core.task.AsyncTaskExecutor
public boolean prefersShortLivedTasks()
prefersShortLivedTasks
in interface SchedulingTaskExecutor
true
if this TaskExecutor
prefers
short-lived taskspublic void destroy()
Timer
on bean factory shutdown, stopping all scheduled tasks.
destroy
in interface org.springframework.beans.factory.DisposableBean
Timer.cancel()
|
spring-context | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |