public class JobExecutionContextImpl extends Object implements JobExecutionContext
Modifier and Type | Class and Description |
---|---|
static interface |
JobExecutionContextImpl.ASyncHandler
Call back interface to the queue.
|
JobExecutionContext.ResultBuilder
Constructor and Description |
---|
JobExecutionContextImpl(JobHandler handler,
JobExecutionContextImpl.ASyncHandler asyncHandler) |
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.
|
void |
markAsync() |
JobExecutionContext.ResultBuilder |
result()
Build a result for the processing.
|
void |
updateProgress(long eta)
Update the progress to the new ETA.
|
public JobExecutionContextImpl(JobHandler handler, JobExecutionContextImpl.ASyncHandler asyncHandler)
public void markAsync()
public void initProgress(int steps, long eta)
JobExecutionContext
initProgress
in interface JobExecutionContext
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.public void incrementProgressCount(int steps)
JobExecutionContext
JobExecutionContext.initProgress(int, long)
, then the
job progress is assumed to be 100%.
This method has only effect if JobExecutionContext.initProgress(int, long)
has been called first with a positive number for stepsincrementProgressCount
in interface JobExecutionContext
steps
- The number of finished steps since the last call.public void updateProgress(long eta)
JobExecutionContext
JobExecutionContext.initProgress(int, long)
has been called first.updateProgress
in interface JobExecutionContext
eta
- The new ETApublic void log(String message, Object... args)
JobExecutionContext
MessageFormat
class.log
in interface JobExecutionContext
message
- A messageargs
- Additional argumentspublic boolean isStopped()
JobExecutionContext
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()
.isStopped
in interface JobExecutionContext
public void asyncProcessingFinished(JobExecutionResult result)
JobExecutionContext
asyncProcessingFinished
in interface JobExecutionContext
public JobExecutionContext.ResultBuilder result()
JobExecutionContext
result
in interface JobExecutionContext
Copyright © 2007–2015 The Apache Software Foundation. All rights reserved.