01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
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: int getJobCount();
31:
32: /**
33: * Reset the processed job counter
34: */
35: void resetJobCount();
36:
37: /**
38: * Sets the running status of this Worker. If set to false, the Worker will
39: * stop after processing its current job.
40: */
41: void setRunning(boolean status);
42:
43: /**
44: * Sets the moitor of this worker
45: */
46: void setMonitor(WorkerMonitor monitor);
47:
48: /**
49: * Sets the job to execute in security context
50: */
51: void setJob(Runnable job, AccessControlContext context);
52:
53: /**
54: * Sets the job to execute
55: */
56: void setJob(Runnable job);
57:
58: /**
59: * Retrieves the job to execute
60: */
61: Runnable getJob();
62:
63: void start();
64: }
|