org.springframework.batch.core.repository.dao

## Class MapJobExecutionDao

- java.lang.Object
- - org.springframework.batch.core.repository.dao.MapJobExecutionDao

- All Implemented Interfaces:
    JobExecutionDao

      public class MapJobExecutionDao
      extends java.lang.Object
      implements JobExecutionDao

  In-memory implementation of `JobExecutionDao`.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `MapJobExecutionDao()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `clear()`
    `java.util.List<JobExecution>` | `findJobExecutions(JobInstance jobInstance)` Return all `JobExecution`s for given `JobInstance`, sorted backwards by creation order (so the first element is the most recent).
    `java.util.Set<JobExecution>` | `findRunningJobExecutions(java.lang.String jobName)`
    `JobExecution` | `getJobExecution(java.lang.Long executionId)`
    `JobExecution` | `getLastJobExecution(JobInstance jobInstance)` Find the last `JobExecution` to have been created for a given `JobInstance`.
    `void` | `saveJobExecution(JobExecution jobExecution)` Save a new JobExecution.
    `void` | `synchronizeStatus(JobExecution jobExecution)` Because it may be possible that the status of a JobExecution is updated while running, the following method will synchronize only the status and version fields.
    `void` | `updateJobExecution(JobExecution jobExecution)` Update and existing JobExecution.

    - ### Methods inherited from class java.lang.Object

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

- - ### Constructor Detail

    - #### MapJobExecutionDao

          public MapJobExecutionDao()

  - ### Method Detail

    - #### clear

          public void clear()

    - #### saveJobExecution

          public void saveJobExecution(JobExecution jobExecution)

      Description copied from interface: `JobExecutionDao`
      Save a new JobExecution. Preconditions: jobInstance the jobExecution belongs to must have a jobInstanceId.
      Specified by:
        `saveJobExecution` in interface `JobExecutionDao`
      Parameters:
        `jobExecution` - `JobExecution` instance to be saved.

    - #### findJobExecutions

          public java.util.List<JobExecution> findJobExecutions(JobInstance jobInstance)

      Description copied from interface: `JobExecutionDao`
      Return all `JobExecution`s for given `JobInstance`, sorted backwards by creation order (so the first element is the most recent).
      Specified by:
        `findJobExecutions` in interface `JobExecutionDao`
      Parameters:
        `jobInstance` - parent `JobInstance` of the `JobExecution`s to find.
      Returns:
        `List` containing JobExecutions for the jobInstance.

    - #### updateJobExecution

          public void updateJobExecution(JobExecution jobExecution)

      Description copied from interface: `JobExecutionDao`
      Update and existing JobExecution. Preconditions: jobExecution must have an Id (which can be obtained by the save method) and a jobInstanceId.
      Specified by:
        `updateJobExecution` in interface `JobExecutionDao`
      Parameters:
        `jobExecution` - `JobExecution` instance to be updated.

    - #### getLastJobExecution

          @Nullable
          public JobExecution getLastJobExecution(@Nullable
                                                            JobInstance jobInstance)

      Description copied from interface: `JobExecutionDao`
      Find the last `JobExecution` to have been created for a given `JobInstance`.
      Specified by:
        `getLastJobExecution` in interface `JobExecutionDao`
      Parameters:
        `jobInstance` - the `JobInstance`
      Returns:
        the last `JobExecution` to execute for this instance or `null` if no job execution is found for the given job instance.

    - #### findRunningJobExecutions

          public java.util.Set<JobExecution> findRunningJobExecutions(java.lang.String jobName)

      Specified by:
        `findRunningJobExecutions` in interface `JobExecutionDao`
      Parameters:
        `jobName` - `String` containing the name of the job.
      Returns:
        all `JobExecution` that are still running (or indeterminate state), i.e. having null end date, for the specified job name.

    - #### getJobExecution

          @Nullable
          public JobExecution getJobExecution(java.lang.Long executionId)

      Specified by:
        `getJobExecution` in interface `JobExecutionDao`
      Parameters:
        `executionId` - `Long` containing the id of the execution.
      Returns:
        the `JobExecution` for given identifier.

    - #### synchronizeStatus

          public void synchronizeStatus(JobExecution jobExecution)

      Description copied from interface: `JobExecutionDao`
      Because it may be possible that the status of a JobExecution is updated while running, the following method will synchronize only the status and version fields.
      Specified by:
        `synchronizeStatus` in interface `JobExecutionDao`
      Parameters:
        `jobExecution` - to be updated.