@ProviderType
public interface JobExecutionContext
Modifier and Type | Interface and Description |
---|---|
static interface |
JobExecutionContext.ResultBuilder |
Modifier and Type | Method and Description |
---|---|
void |
asyncProcessingFinished(JobExecutionResult result)
Report an async result.
|
void |
incrementProgressCount(int steps)
Update the progress by additionally marking the provided
number of steps as finished.
|
void |
initProgress(int steps,
long eta)
Indicate that the job executor is able to report the progress.
|
boolean |
isStopped()
If a job is stoppable, it should periodically check this method
and stop processing if the method return
true . |
void |
log(String message,
Object... args)
Log a message.
|
JobExecutionContext.ResultBuilder |
result()
Build a result for the processing.
|
void |
updateProgress(long eta)
Update the progress to the new ETA.
|
void asyncProcessingFinished(JobExecutionResult result)
result
- Tje job execution resultIllegalStateException
- If the job is not processed asynchronously
or if this method has already been called.boolean isStopped()
true
.
If a job is stopped and the job executor detects this, its up
to the implementation to decide the result of such a state.
There might be use cases where the job returns JobExecutionResult.succeeded()
although it didn't process everything, or JobExecutionResult.failed()
to retry later on or JobExecutionResult.cancelled()
.void initProgress(int steps, long eta)
steps
- Number of total steps or -1 if the number of
steps is unknown.eta
- Number of seconds the process should take or
-1 of it's not known now.void incrementProgressCount(int steps)
initProgress(int, long)
, then the
job progress is assumed to be 100%.
This method has only effect if initProgress(int, long)
has been called first with a positive number for stepssteps
- The number of finished steps since the last call.void updateProgress(long eta)
initProgress(int, long)
has been called first.eta
- The new ETAvoid log(String message, Object... args)
MessageFormat
class.message
- A messageargs
- Additional argumentsJobExecutionContext.ResultBuilder result()
Copyright © 2017 The Apache Software Foundation. All rights reserved.