/** * Gets the elapsed time in milliseconds between the start date of the * first elapsed time and the end of the last elapsed time. If there * are no previous elapsed time, this method has the same effect * as calling {@link #getDuration()}. * @return the total elapsed time */ public final long getTotalDuration() { return getDuration() + getResumedDuration(); }
/** * Checks whether the job ended before its time. This may or may not * be the result of an error. Prematurely ended jobs are eligible * for resuming. * @return <code>true</code> if job finished */ //TODO fix method typo (PrematurEly). @Override public boolean isPrematurlyEnded() { return duration.getEndTime() != null && !isCompleted(); } /**
/** * Checks whether the job was started or not. This is not an indication * that a job is currently running. * @return <code>true</code> if job was started */ @Override public boolean isStarted() { return duration.getStartTime() != null; } /**
jobStatus.setResumeAttempts(config.getInt("resumeAttempts", 0)); JobDuration duration = new JobDuration(); duration.setResumedStartTime( config.getDate("resumedStartTime", null)); duration.setResumedLastActivity( config.getDate("resumedLastActivity", null)); duration.setStartTime(config.getDate("startTime", null)); duration.setEndTime(config.getDate("endTime", null)); jobStatus.setDuration(duration);
if (jobStatus.getResumeAttempts() > 0) { config.setInt("resumeAttempts", jobStatus.getResumeAttempts()); config.setDate("resumedStartTime", duration.getResumedStartTime()); config.setDate("resumedLastActivity", duration.getResumedLastActivity()); if (duration.getStartTime() != null) { config.setDate("startTime", duration.getStartTime()); if (duration.getEndTime() != null) { config.setDate("endTime", duration.getEndTime());
@Override public void visitJobStatus(IJobStatus jobStatus) { MutableJobStatus status = (MutableJobStatus) jobStatus; status.setStopRequested(false); JobDuration duration = status.getDuration(); if (status.isStarted() && !status.isCompleted()) { status.incrementResumeAttempts(); if (duration != null) { duration.setResumedStartTime( duration.getStartTime()); duration.setResumedLastActivity( status.getLastActivity()); } } } });
try { if (status.getResumeAttempts() == 0) { status.getDuration().setStartTime(new Date()); LOG.info("Running " + job.getId() + ": BEGIN (" + status.getDuration().getStartTime() + ")"); fire(jobLifeCycleListeners, "jobStarted", status); } else { + ": RESUME (" + new Date() + ")"); fire(jobLifeCycleListeners, "jobResumed", status); status.getDuration().setEndTime(null); status.setNote(""); status.getDuration().setEndTime(new Date()); try { getJobStatusStore().write(getId(), status); + ": END (" + status.getDuration().getStartTime() + ")");
public long getDuration() { return status.getDuration().getDuration(); } public void setNote(String note) {
/** * Checks whether the job was aborted or not (i.e. killed). That is, if * the job started and is no longer running, while it never * marked as finished. Remember that under normal conditions, a job * should always finish, whether it failed or not. An aborted progress * is usually the results of a job suite which got "killed" in the middle * of its execution (not having the chance to return properly). * @return <code>true</code> if job was started * @since 1.1 */ @Override public boolean isAborted() { return isStarted() && !isRunning() && duration.getEndTime() == null && !isCompleted(); }
private void backupSuite(JobSuiteStatusSnapshot statusTree) throws IOException { IJobStatus suiteStatus = statusTree.getRoot(); Date backupDate = suiteStatus.getDuration().getEndTime(); if (backupDate == null) { backupDate = suiteStatus.getLastActivity();