|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.norconex.jef.progress.JobProgress
public final class JobProgress
Responsible for keeping track reporting job execution progress.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface com.norconex.jef.progress.IJobStatus |
---|
IJobStatus.Status |
Field Summary | |
---|---|
static long |
ACTIVITY_CHECK
Frequency of activity check. |
Constructor Summary | |
---|---|
JobProgress(String jobId,
IJobContext jobContext,
IJobStatus jobStatus,
JobElapsedTime elapsedTime)
Creates a job progress initialised with values from a failed job progress we are recovering from. |
|
JobProgress(String jobId,
IJobContext jobContext,
JobElapsedTime elapsedTime)
Constructor. |
|
JobProgress(String jobId,
IJobContext jobContext,
JobElapsedTime elapsedTime,
long progress)
Constructor. |
Method Summary | |
---|---|
void |
addJobProgressListener(IJobProgressListener listener)
Adds a job progress listener. |
protected void |
fireProgressChanged()
Notifies all listeners of a change of progress. |
double |
getCompletionRatio()
Gets the job completion ration. |
long |
getElapsedTime()
Gets how long it took to finish a job, in milliseconds. |
String |
getElapsedTimeAsString()
Gets a string representation of how long it tooks to finish a job. |
Date |
getEndTime()
Gets the end date of this progress. |
IJobContext |
getJobContext()
Gets contextual information about a job. |
String |
getJobId()
Gets the associated job unique identifier. |
Date |
getLastActivity()
Gets the date on which last activity on the job execution occured. |
IJobStatus |
getLastFailedJobStatus()
Gets the last previously failed job progress, if any (assuming we are in recovery). |
String |
getMetadata()
Gets meta-data associated with this job progress. |
String |
getNote()
Gets the current progress note. |
long |
getProgress()
Gets the current progress. |
Date |
getStartTime()
Gets the end start of this progress. |
IJobStatus.Status |
getStatus()
Gets the job execution status. |
void |
incrementProgress(long incrementValue)
Increments the current progress by the given increment value. |
boolean |
isRecovery()
Whether this progress is from a recovery attempt from a previously failed job. |
boolean |
isStatus(IJobStatus.Status... status)
Checks whether the current progress status matches any of the supplied statuses. |
boolean |
isStopRequested()
Whether a request stop this job was received. |
void |
removeJobProgressListener(IJobProgressListener listener)
Removes a job progress listener. |
void |
setMetadata(String metadata)
Sets meta-data associated with this job progress. |
void |
setNote(String note)
Sets teh current progress note. |
void |
setProgress(long progress)
Sets the current progress. |
void |
stopRequestReceived()
Notifies the job progress that a stop request was received. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final long ACTIVITY_CHECK
Constructor Detail |
---|
public JobProgress(String jobId, IJobContext jobContext, JobElapsedTime elapsedTime)
jobId
- job idjobContext
- job contextual infoelapsedTime
- execution elapsed timepublic JobProgress(String jobId, IJobContext jobContext, JobElapsedTime elapsedTime, long progress)
jobId
- job idjobContext
- job contextual infoelapsedTime
- execution elapsed timeprogress
- current job progresspublic JobProgress(String jobId, IJobContext jobContext, IJobStatus jobStatus, JobElapsedTime elapsedTime)
jobId
- job idjobContext
- job contextual infojobStatus
- job statuselapsedTime
- execution elapsed timeMethod Detail |
---|
public IJobContext getJobContext()
getJobContext
in interface IJobStatus
public String getNote()
getNote
in interface IJobStatus
public void setNote(String note)
note
- The note to set.public long getProgress()
getProgress
in interface IJobStatus
public void setProgress(long progress)
progress
- The progress to set.public void incrementProgress(long incrementValue)
incrementValue
- value by which the progress will be incrementedpublic String getJobId()
getJobId
in interface IJobStatus
public Date getEndTime()
null
if the progress
never finished.
getEndTime
in interface IJobStatus
public Date getLastActivity()
getLastActivity
in interface IJobStatus
public String getMetadata()
getMetadata
in interface IJobStatus
public void setMetadata(String metadata)
metadata
- meta-datapublic Date getStartTime()
null
if the progress
never started.
getStartTime
in interface IJobStatus
public long getElapsedTime()
getElapsedTime
in interface IJobStatus
public String getElapsedTimeAsString()
public void addJobProgressListener(IJobProgressListener listener)
listener
- job progress listener to addpublic void removeJobProgressListener(IJobProgressListener listener)
listener
- job progress listener to removepublic double getCompletionRatio()
getCompletionRatio
in interface IJobStatus
public IJobStatus.Status getStatus()
getStatus
in interface IJobStatus
public boolean isStopRequested()
IJobStatus
isStopRequested
in interface IJobStatus
true
if a stop request was received.public boolean isRecovery()
isRecovery
in interface IJobStatus
true
if the current progress is a recoverypublic IJobStatus getLastFailedJobStatus()
public boolean isStatus(IJobStatus.Status... status)
status
- one or more statuses to match
true
if progress status matches supplied statusesprotected void fireProgressChanged()
public String toString()
toString
in class Object
public void stopRequestReceived()
stopRequestReceived
in interface ISuiteStopRequestListener
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |