View Javadoc
1 /* Reattore HTTP Server 2 3 Copyright (C) 2002 Michael Hope <michaelh@juju.net.nz> 4 5 This program is free software; you can redistribute it and/or modify 6 it under the terms of the GNU General Public License as published by 7 the Free Software Foundation; either version 2 of the License, or 8 (at your option) any later version. 9 10 This program is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with this program; if not, write to the Free Software 17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 19 $Id: LoadTest.java,v 1.6 2003/01/21 22:43:10 michaelh Exp $ 20 */ 21 22 package juju.reattore.loadtest; 23 24 import juju.reattore.loadtest.controller.impl.*; 25 import juju.reattore.core.reactor.impl.*; 26 27 import java.io.*; 28 import java.net.*; 29 import org.apache.commons.logging.*; 30 31 /*** Load test tool command line wrapper. 32 */ 33 public class LoadTest { 34 35 private static Log log = LogFactory.getLog(LoadTest.class); 36 37 private static class ReactorThread 38 extends Thread { 39 40 private CombinedReactor reactor; 41 42 private ReactorThread(CombinedReactor reactor) { 43 this.reactor = reactor; 44 } 45 46 public void run() { 47 try { 48 reactor.go(); 49 } 50 catch (IOException ex) { 51 ex.printStackTrace(); 52 } 53 } 54 } 55 56 /*** Creates and starts the server. 57 58 @param rate The rate to run at. 59 @throws IOException passed up from lower levels. 60 */ 61 public void go(double rate) 62 throws IOException { 63 64 RoundRobinChooser ch = new RoundRobinChooser(); 65 ch.addTarget(new URL("http://localhost:8081/")); 66 67 CombinedReactor reactor = new CombinedReactor(); 68 69 new ReactorThread(reactor).start(); 70 71 new BaseController(ch, reactor).go(rate, 600.0); 72 } 73 74 /*** Entry point. 75 76 @param args Unused 77 @throws Exception passed up from lower levels. 78 */ 79 public static void main(String[] args) 80 throws Exception { 81 82 double rate = 100.0; 83 84 if (args.length > 0) { 85 rate = Double.parseDouble(args[0]); 86 } 87 88 log.info("Starting the load test at the rate " + rate); 89 new LoadTest().go(rate); 90 } 91 }

This page was automatically generated by Maven