aboutsummaryrefslogtreecommitdiff
path: root/id/server/idserverlib/src/test/java/test/lasttest/Dispatcher.java
diff options
context:
space:
mode:
Diffstat (limited to 'id/server/idserverlib/src/test/java/test/lasttest/Dispatcher.java')
-rw-r--r--id/server/idserverlib/src/test/java/test/lasttest/Dispatcher.java88
1 files changed, 88 insertions, 0 deletions
diff --git a/id/server/idserverlib/src/test/java/test/lasttest/Dispatcher.java b/id/server/idserverlib/src/test/java/test/lasttest/Dispatcher.java
new file mode 100644
index 000000000..2b0e5991c
--- /dev/null
+++ b/id/server/idserverlib/src/test/java/test/lasttest/Dispatcher.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright 2003 Federal Chancellery Austria
+ * MOA-ID has been developed in a cooperation between BRZ, the Federal
+ * Chancellery Austria - ICT staff unit, and Graz University of Technology.
+ *
+ * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence.
+ * You may obtain a copy of the Licence at:
+ * http://www.osor.eu/eupl/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the Licence is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the Licence for the specific language governing permissions and
+ * limitations under the Licence.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text
+ * file for details on the various modules and licenses.
+ * The "NOTICE" text file is part of the distribution. Any derivative works
+ * that you distribute must include a readable copy of the "NOTICE" text file.
+ */
+
+
+package test.lasttest;
+
+/**
+ * @author Stefan Knirsch
+ * @version $Id$
+ *
+ */
+public class Dispatcher extends Thread {
+ private LasttestClient parent = null;
+ private int max;
+ private int turns;
+ private int turn_counter;
+ private int turn;
+ private int time;
+ private long sum;
+ private int turnnum;
+
+ public Dispatcher(LasttestClient parent, int max, int turns, int time, long sum) {
+ this.parent = parent;
+ this.max = max;
+ this.turns = turns;
+ this.time = time;
+ this.sum = sum;
+ turnnum=0;
+ }
+
+ public void run() {
+ this.setPriority(Thread.NORM_PRIORITY + 1);
+ System.out.println("Dispatcher wird gestartet...");
+ TestThread[] old_reqs = buildRequests(0);
+ for (turn_counter = 0; turns == 0 ? true : (turn_counter < turns); turn_counter++) {
+ try {
+// LasttestClient.Log.write(("Starte Durchlauf " + turn_counter + "\n").getBytes());
+ }
+ catch (Exception e) {}
+
+// System.out.println("Starte Durchlauf " + turn_counter);
+ turn = turn_counter;
+ if (turns == 0)
+ turn_counter--;
+ TestThread[] reqs = buildRequests(turn_counter);
+ for (int counter = 0; counter < max; counter++) {
+ old_reqs[counter].start();
+ }
+ old_reqs = reqs;
+ try {
+ Thread.sleep(time);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ parent.stop = true;
+ }
+
+ public TestThread[] buildRequests(int turnNo) {
+ TestThread[] ret = new TestThread[max];
+ for (int counter = 0; counter < max; counter++) {
+// turnnum ++;
+ ret[counter] = new TestThread(parent, turnNo);
+ }
+ return ret;
+ }
+}