1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.job

File JobExecutor.java

 

Code metrics

0
0
0
1
74
11
0
-
-
0
-

Classes

Class Line # Actions
JobExecutor 36 0 - 0 0
-1.0 -
 

Contributing tests

No tests hitting this source file were found.

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20    package org.xwiki.job;
21   
22    import java.util.List;
23   
24    import org.xwiki.component.annotation.Role;
25   
26    /**
27    * By default Jobs are either executed asynchronously whenever there is a free thread in the pool. Jobs can implement
28    * {@link GroupedJob} to make sure they con't be executed at the same time than the jobs from the same groups.
29    *
30    * @version $Id: 247476a59f39d923de950d7e07d5c7b0ca8f2312 $
31    * @see GroupedJob
32    * @see Job
33    * @since 6.1M2
34    */
35    @Role
 
36    public interface JobExecutor
37    {
38    /**
39    * The current job running in the passed jobs group.
40    *
41    * @param groupPath the group path
42    * @return the currently running job in the passed group
43    */
44    Job getCurrentJob(JobGroupPath groupPath);
45   
46    /**
47    * Return job corresponding to the provided id from the current executed or waiting jobs.
48    *
49    * @param jobId the id of the job
50    * @return the job status corresponding to the provided job id, null if none can be found
51    */
52    Job getJob(List<String> jobId);
53   
54    /**
55    * Create and add a new job in the queue of jobs to execute.
56    *
57    * @param jobType the role hint of the job component
58    * @param request the request
59    * @return the created job
60    * @throws JobException error when creating the job
61    * @throws java.util.concurrent.RejectedExecutionException if this task cannot be accepted for execution (for
62    * example when the {@link JobExecutor} is disposed).
63    */
64    Job execute(String jobType, Request request) throws JobException;
65   
66    /**
67    * Add a new job in the queue of jobs to execute.
68    *
69    * @param job the job to execute
70    * @throws java.util.concurrent.RejectedExecutionException if this task cannot be accepted for execution (for
71    * example when the {@link JobExecutor} is disposed).
72    */
73    void execute(Job job);
74    }