use of org.apache.oozie.executor.jpa.CoordJobsGetForPurgeJPAExecutor in project oozie by apache.
the class PurgeXCommand method loadState.
/* (non-Javadoc)
* @see org.apache.oozie.command.XCommand#loadState()
*/
@Override
protected void loadState() throws CommandException {
try {
jpaService = Services.get().get(JPAService.class);
if (jpaService != null) {
// Get the lists of workflows, coordinators, and bundles that can be purged (and have no parents)
int size;
do {
size = wfList.size();
wfList.addAll(jpaService.execute(new WorkflowJobsGetForPurgeJPAExecutor(wfOlderThan, wfList.size(), limit)));
} while (size != wfList.size());
if (purgeOldCoordAction) {
LOG.debug("Purging workflows of long running coordinators is turned on");
do {
size = coordActionList.size();
long olderThan = wfOlderThan;
List<WorkflowJobBean> jobBeans = WorkflowJobQueryExecutor.getInstance().getList(WorkflowJobQuery.GET_COMPLETED_COORD_WORKFLOWS_OLDER_THAN, olderThan, coordActionList.size(), limit);
for (WorkflowJobBean bean : jobBeans) {
coordActionList.add(bean.getParentId());
wfList.add(bean.getId());
}
} while (size != coordActionList.size());
}
do {
size = coordList.size();
coordList.addAll(jpaService.execute(new CoordJobsGetForPurgeJPAExecutor(coordOlderThan, coordList.size(), limit)));
} while (size != coordList.size());
do {
size = bundleList.size();
bundleList.addAll(jpaService.execute(new BundleJobsGetForPurgeJPAExecutor(bundleOlderThan, bundleList.size(), limit)));
} while (size != bundleList.size());
} else {
throw new CommandException(ErrorCode.E0610);
}
} catch (XException ex) {
throw new CommandException(ex);
}
}
Aggregations