/** * Start the benchmark and go to the chosen one. * * @param args */ public void start(String[] args) throws InterruptedException, Exception { // Process command line parameters if (args.length != 1) { System.out.print(getHelp(args)); System.exit(-1); } ParameterEnum benchmarkEnum = null; try { benchmarkEnum = ParameterEnum.valueOf(args[0].replace("-", "").toUpperCase()); } catch (IllegalArgumentException iae) { System.out.print(getHelp(args)); logger.error("Program called with invalid parameter. Shutting down."); System.exit(-1); } logger.info("Starting up {}.", NeddyBenchmark.class.getSimpleName()); // Registers a shutdown hook to free resources of this class. Runtime.getRuntime() .addShutdownHook(new ShutdownThread(this, "NettyBenchmark Shutdown Thread")); // Gets the proper benchmark class. Benchmark benchmark = BenchmarkFactory.getBenchmark(benchmarkEnum); // Setup the proper event pipeline factory for the benchmark. ChannelPipelineFactory pipelineFactory = benchmark.getPipeline(); getBootstrap().setPipelineFactory(pipelineFactory); // Set some necessary or convenient socket options in the bootstrap. benchmark.configureBootstrap(getBootstrap()); // Execute the requested benchmark. benchmark.execute(); }