Add missing license headers to packetcable-driver base
[packetcable.git] / packetcable-driver / src / main / java / org / pcmm / concurrent / IWorkerPool.java
1 /**
2  * 
3  */
4 package org.pcmm.concurrent;
5
6 import org.pcmm.base.IAdapter;
7
8 /**
9  * 
10  */
11 public interface IWorkerPool extends IAdapter<IWorker> {
12         // handles 32 workers
13         static int DEFAULT_MAX_WORKERS = 32;
14
15         /**
16          * schedules a worker for beginning its task after t milliseconds.
17          * 
18          * @param worker
19          *            : the worker
20          * @param t
21          *            : time to wait
22          * @return the id of the worker (PID) to be used for killing the worker if
23          *         needed
24          */
25         int schedule(IWorker worker, int t);
26
27         /**
28          * schedules a worker for immediate execution.
29          * 
30          * @param worker
31          *            : the worker
32          * @return the id of the worker (PID) to be used for killing the worker if
33          *         needed
34          */
35         int schedule(IWorker worker);
36
37         /**
38          * kills the worker with the specified pid
39          * 
40          * @param pid
41          */
42         void sendKillSignal(int pid);
43
44         /**
45          * sends a terminate signal for all active workers and recycles the pool.
46          */
47         void killAll();
48
49         /**
50          * cleans up the pool from finished tasks
51          */
52         void recycle();
53
54 }