1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.jetspeed.aggregator;
18
19 import java.security.AccessControlContext;
20
21 /***
22 * Worker thread processes jobs and notify its WorkerMonitor when completed.
23 * When no work is available, the worker simply sets itself in a waiting mode
24 * pending reactivation by the WorkerMonitor
25 *
26 * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
27 * @version $Id: $
28 */
29 public interface Worker
30 {
31 int getJobCount();
32
33 /***
34 * Reset the processed job counter
35 */
36 void resetJobCount();
37
38 /***
39 * Sets the running status of this Worker. If set to false, the Worker will
40 * stop after processing its current job.
41 */
42 void setRunning(boolean status);
43
44 /***
45 * Sets the moitor of this worker
46 */
47 void setMonitor(WorkerMonitor monitor);
48
49 /***
50 * Sets the job to execute in security context
51 */
52 void setJob(Runnable job, AccessControlContext context);
53
54 /***
55 * Sets the job to execute
56 */
57 void setJob(Runnable job);
58
59 /***
60 * Retrieves the job to execute
61 */
62 Runnable getJob();
63
64 void start();
65 }