示例#1
0
 /**
  * Runs the stress test.
  *
  * @param clients number of clients
  * @throws Exception exception
  */
 private void run(final int clients) throws Exception {
   // run server instance
   server = createServer();
   // run clients
   final Client[] cl = new Client[clients];
   for (int i = 0; i < clients; ++i) cl[i] = new Client();
   for (final Client c : cl) c.start();
   for (final Client c : cl) c.join();
   // stop server
   stopServer(server);
 }
示例#2
0
 /**
  * Runs the stress test.
  *
  * @param clients number of clients
  * @param runs number of runs per client
  * @throws Exception exception
  */
 private void run(final int clients, final int runs) throws Exception {
   // run server instance
   server = createServer();
   // create test database
   try (final ClientSession cs = createClient()) {
     cs.execute("create db test <test/>");
     // run clients
     final Client[] cl = new Client[clients];
     for (int i = 0; i < clients; ++i) cl[i] = new Client(runs, i % 2 == 0);
     for (final Client c : cl) c.start();
     for (final Client c : cl) c.join();
     // drop database and stop server
     cs.execute("drop db test");
   }
   stopServer(server);
 }