public class

SyncTaskExecutor

extends Object
implements Serializable TaskExecutor
java.lang.Object
   ↳ org.springframework.core.task.SyncTaskExecutor

Class Overview

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 it's 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.

Summary

Public Constructors
SyncTaskExecutor()
Public Methods
void execute(Runnable task)
Executes the given task synchronously, through direct invocation of it's run() method.
[Expand]
Inherited Methods
From class java.lang.Object
From interface java.util.concurrent.Executor
From interface org.springframework.core.task.TaskExecutor

Public Constructors

public SyncTaskExecutor ()

Also: SpringCore

Public Methods

public void execute (Runnable task)

Also: SpringCore

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

Parameters
task the Runnable to execute (never null)
Throws
IllegalArgumentException if the given task is null