Overview | Package | Class | Tree | Deprecated | Index | Help
| Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.springframework.core.task
Class SyncTaskExecutor

    java.lang.Object
      org.springframework.core.task.SyncTaskExecutor

All Implemented Interfaces:
  java.io.Serializable, java.util.concurrent.Executor, TaskExecutor

    public class SyncTaskExecutor

extends java.lang.Object
implements TaskExecutor, java.io.Serializable

`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.

Since:
  2.0
Author:
  Juergen Hoeller
See Also:
  `SimpleAsyncTaskExecutor`, Serialized Form

Constructor Summary
`SyncTaskExecutor()`

Method Summary
`void` | `execute(java.lang.Runnable task)` Executes the given `task` synchronously, through direct invocation of it's `run()` method.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### SyncTaskExecutor

    public SyncTaskExecutor()

Method Detail

### execute

    public void execute(java.lang.Runnable task)

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

  Specified by:
    `execute` in interface `java.util.concurrent.Executor`
  Specified by:
    `execute` in interface `TaskExecutor`
  Parameters:
    `task` - the `Runnable` to execute (never `null`)
  Throws:
    `java.lang.IllegalArgumentException` - if the given `task` is `null`

Overview | Package | Class | Tree | Deprecated | Index | Help
| Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD