public class TrackedJob
extends java.lang.Object
A job graph node used for tracking the status of work.
Constructor and Description |
---|
TrackedJob(java.lang.String type)
Create a new tracked job.
|
TrackedJob(java.lang.String type,
java.lang.String desc)
Create a new tracked job.
|
Modifier and Type | Method and Description |
---|---|
void |
fail(java.lang.Throwable th)
Record the job as being failed.
|
void |
finish()
Record the job as being finished.
|
void |
finishStep()
Mark a step as finished.
|
void |
finishSteps(int n)
Mark steps as finished.
|
int |
getChildCount()
Get the number of children.
|
int |
getChildrenFinished()
Get the number of finished children.
|
int |
getChildrenRunning()
Get the number of running children.
|
java.lang.String |
getDescription() |
EventBus |
getEventBus() |
java.lang.Throwable |
getException()
Get the exception with which this job failed.
|
int |
getExpectedSteps()
Get the estimated number of steps.
|
TrackedJob |
getParent()
Get the parent job.
|
int |
getReportingInterval()
Get the reporting interval for firing progress update messages.
|
int |
getStepsFinished()
Get the number of finished steps.
|
Stopwatch |
getTimer()
Get the timer for this job.
|
java.lang.String |
getType() |
java.util.UUID |
getUUID() |
TrackedJob |
makeChild(java.lang.String type)
Create a child job.
|
TrackedJob |
makeChild(java.lang.String type,
java.lang.String description)
Create a child job.
|
void |
setReportingInterval(int iv)
Set the reporting interval for firing progress update messages.
|
void |
start()
Start the job.
|
void |
start(int steps)
Start the job with an estimated number of steps.
|
java.lang.String |
toString() |
public TrackedJob(java.lang.String type)
Create a new tracked job.
type
- The job type code.public TrackedJob(java.lang.String type, java.lang.String desc)
Create a new tracked job.
type
- The job type code.desc
- The description.@Nonnull public EventBus getEventBus()
public java.util.UUID getUUID()
@Nullable public TrackedJob getParent()
Get the parent job.
public TrackedJob makeChild(@Nonnull java.lang.String type)
Create a child job.
type
- The job type.public TrackedJob makeChild(@Nonnull java.lang.String type, @Nullable java.lang.String description)
Create a child job.
type
- The job type.description
- The job description.@Nonnull public java.lang.String getType()
@Nullable public java.lang.String getDescription()
public int getExpectedSteps()
Get the estimated number of steps. This does not include children.
public int getStepsFinished()
Get the number of finished steps.
public int getChildCount()
Get the number of children.
public int getChildrenRunning()
Get the number of running children.
public int getChildrenFinished()
Get the number of finished children.
public int getReportingInterval()
Get the reporting interval for firing progress update messages.
public void setReportingInterval(int iv)
Set the reporting interval for firing progress update messages.
iv
- The reporting interval.public void finishStep()
Mark a step as finished.
public void finishSteps(int n)
Mark steps as finished.
n
- The number of additional steps that have been finished.public void start()
Start the job.
public void start(int steps)
Start the job with an estimated number of steps.
steps
- The estimated number of steps.public void finish()
Record the job as being finished.
public void fail(@Nullable java.lang.Throwable th)
Record the job as being failed.
th
- The error that is causing the job to fail.@Nullable public java.lang.Throwable getException()
Get the exception with which this job failed.
public Stopwatch getTimer()
Get the timer for this job.
public java.lang.String toString()
toString
in class java.lang.Object