org.springframework.core.task

## 类 SyncTaskExecutor

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

- 所有已实现的接口:
    Serializable, Executor, TaskExecutor

      public class SyncTaskExecutor
      extends Object
      implements TaskExecutor, 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.

  从以下版本开始:
    2.0
  作者:
    Juergen Hoeller
  另请参阅:
    `SimpleAsyncTaskExecutor`, 序列化表格

- - ### 构造器概要

    构造器
    构造器和说明
    `SyncTaskExecutor()`

  - ### 方法概要

    所有方法 实例方法 具体方法
    限定符和类型 | 方法和说明
    --- | ---
    `void` | `execute(Runnable task)` Executes the given `task` synchronously, through direct invocation of it's `run()` method.

    - ### 从类继承的方法 java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 构造器详细资料

    - #### SyncTaskExecutor

          public SyncTaskExecutor()

  - ### 方法详细资料

    - #### execute

          public void execute(Runnable task)

      Executes the given `task` synchronously, through direct invocation of it's `run()` method.
      指定者:
        `execute` 在接口中 `Executor`
      指定者:
        `execute` 在接口中 `TaskExecutor`
      参数:
        `task` - the `Runnable` to execute (never `null`)
      抛出:
        `IllegalArgumentException` - if the given `task` is `null`