サーバーに接続している複数のクライアントをエミュレートして、クライアント/サーバーシステムのストレステストを試みています。クライアントごとにスレッドがあります。しかし、次のコードを実行すると(ClientStartEmulator()はクライアントを表します)、スレッドは同時にではなく順次実行されます。(複数のスレッドが生成され、エミュレートされた各クライアント内でスリープしているにもかかわらず)。何が悪いのか考えてみませんか?
別の方法は、各jarに対してシステムコールを実行することですが、これは煩わしいものです(ここには示されていません)。返された配列に対していくつかの処理を実行します。
ありがとう!
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();
}
}