Top Description Constructors Methods
org.springframework.core.task

public Class SyncTaskExecutor

extends Object
implements TaskExecutor, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, org.springframework.core.task.TaskExecutor, java.util.concurrent.Executor
Annotations
@SuppressWarnings:serial
Imports
java.io.Serializable, org.springframework.util.Assert

TaskExecutor implementation that executes each task synchronously in the calling thread.

Mainly intended for testing scenarios.

Execution in the calling thread does have the advantage of participating in its thread context, for example the thread context class loader or the thread's current transaction association. That said, in many cases, asynchronous execution will be preferable: choose an asynchronous TaskExecutor instead for such scenarios.

Author
Juergen Hoeller
Since
2.0
See Also
SimpleAsyncTaskExecutor

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
execute(Runnable
the Runnable to execute (never null)
task
)

Implements org.springframework.core.task.TaskExecutor.execute.

Executes the given task synchronously, through direct invocation of it's run() method.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

SyncTaskExecutorback to summary
public SyncTaskExecutor()

Method Detail

executeback to summary
public void execute(Runnable task)

Implements org.springframework.core.task.TaskExecutor.execute.

Executes the given task synchronously, through direct invocation of it's run() method.

Parameters
task:Runnable

Doc from org.springframework.core.task.TaskExecutor.execute.

the Runnable to execute (never null)

Annotations
@Override
Exceptions
IllegalArgumentException:
if the given task is null