Author: jfrederic.clere(a)jboss.com
Date: 2009-03-03 12:40:21 -0500 (Tue, 03 Mar 2009)
New Revision: 2328
Modified:
trunk/mod_cluster/test/java/org/jboss/mod_cluster/Client.java
Log:
Add an argument to have variable loads.
Modified: trunk/mod_cluster/test/java/org/jboss/mod_cluster/Client.java
===================================================================
--- trunk/mod_cluster/test/java/org/jboss/mod_cluster/Client.java 2009-03-03 09:25:30 UTC
(rev 2327)
+++ trunk/mod_cluster/test/java/org/jboss/mod_cluster/Client.java 2009-03-03 17:40:21 UTC
(rev 2328)
@@ -50,6 +50,7 @@
private int nbtest = 10;
private int delay = 1000;
+ private int wait = 100;
private Random rand = null;
private boolean checkcookie = true;
private boolean checknode = true;
@@ -67,21 +68,22 @@
*
* @param args command line arguments
* Argument 0 is a URL to a web server
- * Argument 1 is the command to execute.
+ * Argument 1 is the max time to wait between requests (in 10
milliseconds units)
*
*/
public static void main(String[] args) throws Exception
{
- if (args.length != 1)
+ if (args.length != 2)
{
System.err.println("missing command line arguments");
System.exit(1);
}
- Client client[] = new Client[200];
+ Client client[] = new Client[500];
for (int i=0; i<client.length; i++) {
client[i] = new Client();
- client[i].runit(args[0], 100, true);
+ client[i].runit(args[0], 100000, true,
Integer.parseInt(args[1]));
}
+ System.out.println("making \"second\" requests");
for (int i=0; i<client.length; i++) {
client[i].start();
}
@@ -143,6 +145,11 @@
return runit();
}
+ public int runit(String URL, int nbtest, boolean checkcookie, int wait) throws
Exception
+ {
+ this.wait = wait;
+ return runit(URL, nbtest, checkcookie);
+ }
public int runit() throws Exception
{
@@ -291,7 +298,7 @@
success = false;
return;
}
- sleep((int)(rand.nextInt(100) * 10));
+ sleep((int)(rand.nextInt(wait) * 10));
} catch (InterruptedException e) {
e.printStackTrace();
success = false;
Show replies by date