Add missing license headers to packetcable-driver concurrent
[packetcable.git] / packetcable-driver / src / main / java / org / pcmm / concurrent / IWorkerPool.java
1 /*
2  * Copyright (c) 2014 Cable Television Laboratories, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.pcmm.concurrent;
10
11 import org.pcmm.base.IAdapter;
12
13 /**
14  *
15  */
16 public interface IWorkerPool extends IAdapter<IWorker> {
17         // handles 32 workers
18         static int DEFAULT_MAX_WORKERS = 32;
19
20         /**
21          * schedules a worker for beginning its task after t milliseconds.
22          *
23          * @param worker
24          *            : the worker
25          * @param t
26          *            : time to wait
27          * @return the id of the worker (PID) to be used for killing the worker if
28          *         needed
29          */
30         int schedule(IWorker worker, int t);
31
32         /**
33          * schedules a worker for immediate execution.
34          *
35          * @param worker
36          *            : the worker
37          * @return the id of the worker (PID) to be used for killing the worker if
38          *         needed
39          */
40         int schedule(IWorker worker);
41
42         /**
43          * kills the worker with the specified pid
44          *
45          * @param pid
46          */
47         void sendKillSignal(int pid);
48
49         /**
50          * sends a terminate signal for all active workers and recycles the pool.
51          */
52         void killAll();
53
54         /**
55          * cleans up the pool from finished tasks
56          */
57         void recycle();
58
59 }