Search in sources :

Example 1 with JobQueueImpl

use of org.apache.sling.event.impl.jobs.queues.JobQueueImpl in project sling by apache.

the class JobManagerImpl method stopJobById.

private void stopJobById(final String jobId, final boolean forward) {
    final JobImpl job = (JobImpl) this.getJobById(jobId);
    if (job != null && !this.configuration.isStoragePath(job.getResourcePath())) {
        // get the queue configuration
        final QueueInfo queueInfo = this.configuration.getQueueConfigurationManager().getQueueInfo(job.getTopic());
        final JobQueueImpl queue = (JobQueueImpl) this.qManager.getQueue(queueInfo.queueName);
        boolean stopped = false;
        if (queue != null) {
            stopped = queue.stopJob(job);
        }
        if (forward && !stopped) {
            // mark the job as stopped
            final JobHandler jh = new JobHandler(job, null, this.configuration);
            jh.finished(JobState.STOPPED, true, null);
        }
    }
}
Also used : QueueInfo(org.apache.sling.event.impl.jobs.config.QueueConfigurationManager.QueueInfo) JobQueueImpl(org.apache.sling.event.impl.jobs.queues.JobQueueImpl)

Aggregations

QueueInfo (org.apache.sling.event.impl.jobs.config.QueueConfigurationManager.QueueInfo)1 JobQueueImpl (org.apache.sling.event.impl.jobs.queues.JobQueueImpl)1