|
1 |
| |
|
2 |
| |
|
3 |
| |
|
4 |
| |
|
5 |
| |
|
6 |
| |
|
7 |
| package jtr.runners; |
|
8 |
| |
|
9 |
| import org.apache.log4j.Logger; |
|
10 |
| |
|
11 |
| |
|
12 |
| |
|
13 |
| |
|
14 |
| |
|
15 |
| |
|
16 |
| |
|
17 |
| |
|
18 |
| |
|
19 |
| |
|
20 |
| public abstract class AbstractRunner extends AbstractRunnerAncestor { |
|
21 |
| |
|
22 |
| |
|
23 |
| |
|
24 |
| |
|
25 |
| |
|
26 |
| |
|
27 |
| |
|
28 |
| |
|
29 |
| |
|
30 |
| |
|
31 |
| |
|
32 |
| |
|
33 |
| |
|
34 |
2500
| public final void run() {
|
|
35 |
2500
| logger = Logger.getLogger(this.getClass().getName());
|
|
36 |
2500
| logger.debug("Running client thread...");
|
|
37 |
2500
| for (currentRun = 0; currentRun < getRuns(); currentRun++) {
|
|
38 |
| |
|
39 |
29995
| try {
|
|
40 |
29997
| logger.debug("Starting run " + currentRun + " in epoch " + epoch);
|
|
41 |
29992
| doRunTest();
|
|
42 |
| } catch (Throwable t) { |
|
43 |
10003
| handleFailure(currentRun, t);
|
|
44 |
| } |
|
45 |
| |
|
46 |
30000
| try {
|
|
47 |
30000
| if (currentRun < getRuns() - 1) {
|
|
48 |
27500
| logger.debug("Completed, going to bed for a while... [" + getSleepTime() + " mSecs.]");
|
|
49 |
27500
| Thread.sleep(getSleepTime());
|
|
50 |
27498
| logger.debug("Awaken");
|
|
51 |
| |
|
52 |
| |
|
53 |
27497
| logger.debug("Check for reinitialization");
|
|
54 |
27499
| if (paramsAssigner.requiresReinitialization()) {
|
|
55 |
| |
|
56 |
9500
| logger.debug("Reinitialization required...");
|
|
57 |
9499
| paramsAssigner.reAssign(clean());
|
|
58 |
9500
| logger.debug("... reinitialized");
|
|
59 |
| } else { |
|
60 |
| |
|
61 |
17998
| logger.debug("Reinitialization not required");
|
|
62 |
| } |
|
63 |
| } |
|
64 |
| } catch (InterruptedException e) { |
|
65 |
0
| String msg = "The current test-thread " + Thread.currentThread().getName() + " received an interrupt while sleeping";
|
|
66 |
0
| logger.warn(msg, e);
|
|
67 |
| } |
|
68 |
| } |
|
69 |
| |
|
70 |
2500
| logger.debug("Completed all the runs [" + getRuns() + "], going back into the pool");
|
|
71 |
2500
| logger.debug("Getting IPoolManager instance...");
|
|
72 |
2500
| pool.getPoolManager().backIntoPool(this);
|
|
73 |
| } |
|
74 |
| |
|
75 |
| |
|
76 |
| |
|
77 |
| |
|
78 |
| |
|
79 |
| |
|
80 |
39999
| public int getCurrentRun() {
|
|
81 |
39998
| return currentRun;
|
|
82 |
| } |
|
83 |
| |
|
84 |
| |
|
85 |
| |
|
86 |
| |
|
87 |
| |
|
88 |
| |
|
89 |
| |
|
90 |
| |
|
91 |
| public abstract void test() throws Throwable; |
|
92 |
| |
|
93 |
| private int currentRun; |
|
94 |
| } |