*/
public ArrayList<Job> getExpiredJobs() {
ArrayList expiredJobs = new ArrayList();
Iterator<Job> jobs = getJobs();
while ( jobs.hasNext()) {
Job job = jobs.next();
long executedTime = job.getCommandExecutionDate();
long currentTime = System.currentTimeMillis();
long jobsRetentionPeriod = 86400000;
boolean enableJobManager = Boolean.parseBoolean(System.getProperty("enableJobManager"));
if (enableJobManager) {
managedJobConfig = domain.getExtensionByType(ManagedJobConfig.class);
jobsRetentionPeriod = convert(managedJobConfig.getJobRetentionPeriod());
}
if (currentTime - executedTime > jobsRetentionPeriod &&
job.getState().equals(AdminCommandState.State.COMPLETED)) {
expiredJobs.add(job);
}
}
return expiredJobs;