1 /*
2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
5 *
6 * http://www.apache.org/licenses/LICENSE-2.0
7 *
8 * Unless required by applicable law or agreed to in writing, software
9 * distributed under the License is distributed on an "AS IS" BASIS,
10 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 * See the License for the specific language governing permissions and
12 * limitations under the License.
13 */
14
15 package net.sourceforge.basher;
16
17 /**
18 * Defines operations for interacting with the scheduler service. Users of the scheduler can stop and start
19 * the scheduler, add and remove threads and retrieve statistics about currently running threads.
20 *
21 * @author Johan Lindquist
22 * @version 1.0
23 */
24 public interface Scheduler
25 {
26 /**
27 * Adds a thread to the currently running scheduler.
28 */
29 public void addThread();
30
31 /**
32 * Adds the specified number of threads to the currently running scheduler.
33 *
34 * @param numToAdd The number of threads to add
35 */
36 public void addThreads(int numToAdd);
37
38 /**
39 * Removes a thread from the currently running scheduler
40 */
41 public void removeThread();
42
43 /**
44 * Removes all threads from the currently running scheduler
45 */
46 public void removeAllThreads();
47
48 /**
49 * Stops the scheduler.
50 */
51 public void stop();
52
53 /**
54 * Starts the scheduler.
55 */
56 public void start();
57
58 /**
59 * @param contextName
60 */
61 public void start(final String contextName);
62
63 /**
64 * @param basherContext
65 */
66 public void start(final BasherContext basherContext);
67
68 /**
69 * Retrieves the number of threads currently active in the scheduler.
70 *
71 * @return The number of currently active threads
72 */
73 public int getNumberOfActiveThreads();
74
75 /**
76 * Checks whether or not the scheduler is running.
77 *
78 * @return True if the scheduler is running, otherwise false.
79 */
80 public boolean isRunning();
81
82 /**
83 * Removes a thread from the currently running scheduler
84 */
85 public Phase getCurrentPhase();
86
87
88 }