public class SuspendTestTask extends Object implements Task, TaskMessageSource
Modifier and Type | Class and Description |
---|---|
class |
SuspendTestTask.SuspendHandler
Handler for suspend event.
|
Constructor and Description |
---|
SuspendTestTask(CheckpointService checkpointService,
int numCycles,
int delay)
Task constructor: invoked by TANG.
|
Modifier and Type | Method and Description |
---|---|
byte[] |
call(byte[] memento)
Main method of the task: run cycle from 0 to numCycles,
and sleep for delay seconds on each cycle.
|
Optional<TaskMessage> |
getMessage()
Update driver on current state of the task.
|
@Inject public SuspendTestTask(CheckpointService checkpointService, int numCycles, int delay)
numCycles
- number of cycles to run in the task.delay
- delay in seconds between cycles in the task.public byte[] call(byte[] memento) throws IOException, InterruptedException
call
in interface Task
memento
- serialized version of the counter.
Empty array for initial run, but can contain value for resumed job.IOException
InterruptedException
public Optional<TaskMessage> getMessage()
getMessage
in interface TaskMessageSource
Copyright © 2017 The Apache Software Foundation. All rights reserved.