Class | Line # | Actions | |||||
---|---|---|---|---|---|---|---|
Job | 34 | 0 | - | 0 | 0 |
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.concurrent.TimeUnit; | |
23 | ||
24 | import org.xwiki.component.annotation.Role; | |
25 | import org.xwiki.job.event.status.JobStatus; | |
26 | ||
27 | /** | |
28 | * A Job produced from a {@link Request} and exposing a {@link JobStatus}. | |
29 | * | |
30 | * @version $Id: 734e9e8a50aff3337e33a11430c8493cacf29d07 $ | |
31 | * @since 4.0M1 | |
32 | */ | |
33 | @Role | |
34 | public interface Job extends Runnable | |
35 | { | |
36 | /** | |
37 | * @return the type of the job | |
38 | */ | |
39 | String getType(); | |
40 | ||
41 | /** | |
42 | * @return the status of the job | |
43 | */ | |
44 | JobStatus getStatus(); | |
45 | ||
46 | /** | |
47 | * @return the job request | |
48 | */ | |
49 | Request getRequest(); | |
50 | ||
51 | /** | |
52 | * @param request start the job with provided request | |
53 | * @deprecated since 5.1M2 use {@link #initialize(Request)} then {@link #run()} instead | |
54 | */ | |
55 | @Deprecated | |
56 | void start(Request request); | |
57 | ||
58 | /** | |
59 | * @param request configure the job | |
60 | * @since 5.1M1 | |
61 | */ | |
62 | void initialize(Request request); | |
63 | ||
64 | /** | |
65 | * Causes the current thread to wait until this job has FINSHED state. | |
66 | * | |
67 | * @throws InterruptedException if any thread has interrupted the current thread. The <i>interrupted status</i> of | |
68 | * the current thread is cleared when this exception is thrown. | |
69 | */ | |
70 | void join() throws InterruptedException; | |
71 | ||
72 | /** | |
73 | * Causes the current thread to wait until this job has FINSHED state. | |
74 | * | |
75 | * @param time the maximum time to wait | |
76 | * @param unit the time unit of the {@code time} argument | |
77 | * @return {@code false} if the waiting time detectably elapsed before return from the method, else {@code true} | |
78 | * @throws InterruptedException if the current thread is interrupted (and interruption of thread suspension is | |
79 | * supported) | |
80 | */ | |
81 | boolean join(long time, TimeUnit unit) throws InterruptedException; | |
82 | } |