Author: jfrederic.clere(a)jboss.com
Date: 2009-02-03 03:47:31 -0500 (Tue, 03 Feb 2009)
New Revision: 2262
Added:
trunk/mod_cluster/test/java/load.sh
Modified:
trunk/mod_cluster/test/java/org/jboss/mod_cluster/Client.java
Log:
A test for case 258618.
Added: trunk/mod_cluster/test/java/load.sh
===================================================================
--- trunk/mod_cluster/test/java/load.sh (rev 0)
+++ trunk/mod_cluster/test/java/load.sh 2009-02-03 08:47:31 UTC (rev 2262)
@@ -0,0 +1,2 @@
+java -classpath
$HOME/java/commons-codec-1.3.jar:$HOME/java//commons-logging-1.0.4/commons-logging.jar:$HOME/java//commons-httpclient-3.1/commons-httpclient-3.1.jar:output/classes/
org.jboss.mod_cluster.Client
http://dev12:9999/myapp/MyCount
+
Modified: trunk/mod_cluster/test/java/org/jboss/mod_cluster/Client.java
===================================================================
--- trunk/mod_cluster/test/java/org/jboss/mod_cluster/Client.java 2009-02-02 08:42:01 UTC
(rev 2261)
+++ trunk/mod_cluster/test/java/org/jboss/mod_cluster/Client.java 2009-02-03 08:47:31 UTC
(rev 2262)
@@ -58,6 +58,8 @@
public int httpResponseCode = 0;
public String requestedSessionId = null;
+
+ private HttpClient httpClient = null;
/*
*
* Usage:
@@ -75,14 +77,21 @@
System.err.println("missing command line arguments");
System.exit(1);
}
- Client client = new Client();
- client.runit(args[0], 10, true);
- client.start();
- try {
- client.join();
- } catch (InterruptedException ex) {
- ex.printStackTrace();
+ Client client[] = new Client[200];
+ for (int i=0; i<client.length; i++) {
+ client[i] = new Client();
+ client[i].runit(args[0], 100, true);
}
+ for (int i=0; i<client.length; i++) {
+ client[i].start();
+ }
+ for (int i=0; i<client.length; i++) {
+ try {
+ client[i].join();
+ } catch (InterruptedException ex) {
+ ex.printStackTrace();
+ }
+ }
}
/**
@@ -138,10 +147,11 @@
public int runit() throws Exception
{
- HttpClient httpClient = new HttpClient();
PostMethod pm = null;
GetMethod gm = null;
HttpMethodBase bm = null;
+ if (httpClient == null)
+ httpClient = new HttpClient();
if (fd != null) {
pm = new PostMethod(URL);
// InputStreamRequestEntity buf = new InputStreamRequestEntity(fd);
@@ -208,7 +218,7 @@
return 0; // first time ok.
} else {
if (jsessionid.compareTo(cookie.getValue()) == 0)
{
- System.out.println("cookie ok");
+ // System.out.println("cookie
ok");
bm.releaseConnection();
return 0;
} else {
@@ -256,11 +266,13 @@
System.out.println("response: " + httpResponseCode);
System.out.println("response: " + bm.getStatusLine());
success = false;
+ httpClient = null;
}
// System.out.println("response:\n" +
bm.getResponseBodyAsString(len));
} catch(HttpException e) {
e.printStackTrace();
success = false;
+ httpClient = null;
}
System.out.println("DONE: " + httpResponseCode);
bm.releaseConnection();