use of org.candlepin.pinsetter.core.PinsetterException in project candlepin by candlepin.
the class PinsetterAsyncFilterTest method schedulingError.
@Test(expected = ServiceUnavailableException.class)
public void schedulingError() throws PinsetterException {
JobDetail detail = newJob(RefreshPoolsJob.class).build();
when(response.getEntity()).thenReturn(detail);
when(this.pinsetterKernel.scheduleSingleJob(detail)).thenThrow(new PinsetterException("Error scheduling job!"));
this.interceptor.postProcess(response);
}
use of org.candlepin.pinsetter.core.PinsetterException in project candlepin by candlepin.
the class CancelJobJob method toExecute.
@Override
public void toExecute(JobExecutionContext ctx) throws JobExecutionException {
try {
Set<JobKey> keys = pinsetterKernel.getSingleJobKeys();
Set<String> statusIds = new HashSet<>();
for (JobKey key : keys) {
statusIds.add(key.getName());
}
try {
Set<JobStatus> jobs = this.jobCurator.findCanceledJobs(statusIds);
if (jobs.size() > 0) {
pinsetterKernel.cancelJobs(jobs);
}
} catch (PinsetterException e) {
log.error("Exception canceling jobs", e);
}
} catch (SchedulerException e) {
log.error("Unable to cancel jobs", e);
}
}
Aggregations