Package org.apache.ignite.internal.processors.localtask

## Class DurableBackgroundTaskState<R>

- java.lang.Object
- - org.apache.ignite.internal.processors.localtask.DurableBackgroundTaskState<R>

    public class DurableBackgroundTaskState<R>
    extends Object

Class for storing the current state of a durable background task. Task execution state transitions: INIT -> PREPARE -> STARTED -> COMPLETED If the task needs to be restarted, it must have status INIT.

### Nested Class Summary

Nested Classes
`static class` `DurableBackgroundTaskState.State` Enumeration of the current state of the task.

### Constructor Summary

Constructors
`DurableBackgroundTaskState​(DurableBackgroundTask<R> task, GridFutureAdapter<R> outFut, boolean saved, boolean converted)` Constructor.

### Method Summary

All Methods Instance Methods Concrete Methods
`boolean` `converted()` Check if the task has been converted from another.
`GridFutureAdapter<R>` `outFuture()` Getting outside task future.
`boolean` `saved()` Check if the task has been saved to the MetaStorage.
`DurableBackgroundTaskState.State` `state()` Getting current state of the task.
`void` `state​(DurableBackgroundTaskState.State s)` Set the current state of the task.
`boolean` `state​(DurableBackgroundTaskState.State exp, DurableBackgroundTaskState.State newState)` Atomically sets of the current task state.
`DurableBackgroundTask<R>` `task()` Getting durable background task.
`String` `toString()`

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

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

### Constructor Detail

#### DurableBackgroundTaskState

    public DurableBackgroundTaskState​(DurableBackgroundTask<R> task,
                                      GridFutureAdapter<R> outFut,
                                      boolean saved,
                                      boolean converted)

Constructor.

Parameters:
  `task` - Durable background task.
  `outFut` - Outside task future.
  `saved` - Task has been saved to the MetaStorage.

### Method Detail

#### task

    public DurableBackgroundTask<R> task()

Getting durable background task.

Returns:
  Durable background task.

#### outFuture

    public GridFutureAdapter<R> outFuture()

Getting outside task future.

Returns:
  Outside task future.

#### saved

    public boolean saved()

Check if the task has been saved to the MetaStorage.

Returns:
  `True` if stored in the MetaStorage.

#### state

    public DurableBackgroundTaskState.State state()

Getting current state of the task.

Returns:
  Current state of the task.

#### state

    public void state​(DurableBackgroundTaskState.State s)

Set the current state of the task.

Parameters:
  `s` - New current state of the task.

#### state

    public boolean state​(DurableBackgroundTaskState.State exp,
                         DurableBackgroundTaskState.State newState)

Atomically sets of the current task state.

Parameters:
  `exp` - Expected state.
  `newState` - New state.
Returns:
  `True` if successful.

#### converted

    public boolean converted()

Check if the task has been converted from another.

Returns:
  `True` if it was converted from another task.

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`