I am trying to stress test a client/server system by emulating multiple clients connecting to the server. There is a thread per client. BUT, when I run the following code (ClientStartEmulator() represents a client), threads run sequentially rather than concurrently. (despite there being multiple thread yields and sleep within each emulated client). Any ideas what is wrong?
An alternative would be to do a system call to each jar, but this would be annoying as (not shown here), I do some processing on the arrays returned.
Thanks!
ClientStartEmulator emu = new ClientStartEmulator();
emu.start(7777, "localhost", "examplestore", "foobar", "signFiles", "foobar", true, time, max_length);
ArrayList results = new ArrayList() ;
for (int i = 0 ; i<nb_clients ; i++ ) {
Thread client = new Thread() {
public void run() {
ClientStartEmulator emul = new ClientStartEmulator();
try {
emul.start(7777, "localhost", "examplestore", "foobar", "signFiles", "foobar", false, time, max_length);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
};
client.run();
}
}