CompositeBackgroundJob.SubJobMonitorpublic interface BackgroundJobMonitor
BackgroundJob to communicate with the scheduler.
The BackgroundJobScheduler passes an instance of this type to
BackgroundJob.work(BackgroundJobMonitor), effectively providing the
job with a feedback channel to report progress information.
The BackgroundJob also should use this monitor for all logging and to
periodically poll for cancellation requests. | Modifier and Type | Interface | Description |
|---|---|---|
static class |
BackgroundJobMonitor.Severity |
| Modifier and Type | Method | Description |
|---|---|---|
void |
announceTotal(int totalItems) |
Announce the total amount of work to be done.
|
String |
getScheduledJobId() |
Get the identifier assigned to the
BackgroundJob by the
scheduler. |
boolean |
isAborting() |
Whether the cancellation of the job was requested.
|
void |
log(BackgroundJobMonitor.Severity severity,
Object message) |
write to the (job-specific) log.
|
void |
reportProgressAbsolute(int items) |
Report units of work completed since the begining of the job.
|
void |
reportProgressIncrement(int items) |
Report units of work completed since the last progress report.
|
void log(BackgroundJobMonitor.Severity severity, Object message)
severity - message - boolean isAborting()
BackgroundJobs should poll
this method in regular intervals and exit as quickly as possible if true
is returned.String getScheduledJobId()
BackgroundJob by the
scheduler. void announceTotal(int totalItems)
BackgroundJob should call this method at the beginning of its
execution, as soon as it knows what lies ahead. It is ok to call this
method multiple times with different values to update an initial
assessment as new/more detailed information about the work to be done
becomes available.totalItems - the total units of work to be done.void reportProgressIncrement(int items)
BackgroundJob can use this method to report relative increments.items - number of units of work completed since the last call.void reportProgressAbsolute(int items)
BackgroundJob can use this method to report the absolute amount of work
that was tackled since the execution started.items - number of units of work completed since execution started.Copyright © 2018 tarent solutions GmbH, Germany. All rights reserved.