(String[] args)
| 289 | } |
| 290 | |
| 291 | public static void main(String[] args) throws Exception { |
| 292 | boolean send = true; |
| 293 | boolean debug = false; |
| 294 | long pause = 0; |
| 295 | int count = 1000000; |
| 296 | int stats = 10000; |
| 297 | boolean breakOnEx = false; |
| 298 | int threads = 1; |
| 299 | boolean shutdown = false; |
| 300 | int startoptions = Channel.DEFAULT; |
| 301 | int channelOptions = Channel.SEND_OPTIONS_DEFAULT; |
| 302 | if (args.length == 0) { |
| 303 | args = new String[] { "-help" }; |
| 304 | } |
| 305 | for (int i = 0; i < args.length; i++) { |
| 306 | if ("-threads".equals(args[i])) { |
| 307 | threads = Integer.parseInt(args[++i]); |
| 308 | } else if ("-count".equals(args[i])) { |
| 309 | count = Integer.parseInt(args[++i]); |
| 310 | System.out.println("Sending " + count + " messages."); |
| 311 | } else if ("-pause".equals(args[i])) { |
| 312 | pause = Long.parseLong(args[++i]) * 1000; |
| 313 | } else if ("-break".equals(args[i])) { |
| 314 | breakOnEx = true; |
| 315 | } else if ("-shutdown".equals(args[i])) { |
| 316 | shutdown = true; |
| 317 | } else if ("-stats".equals(args[i])) { |
| 318 | stats = Integer.parseInt(args[++i]); |
| 319 | System.out.println("Stats every " + stats + " message"); |
| 320 | } else if ("-sendoptions".equals(args[i])) { |
| 321 | channelOptions = Integer.parseInt(args[++i]); |
| 322 | System.out.println("Setting send options to " + channelOptions); |
| 323 | } else if ("-startoptions".equals(args[i])) { |
| 324 | startoptions = Integer.parseInt(args[++i]); |
| 325 | System.out.println("Setting start options to " + startoptions); |
| 326 | } else if ("-size".equals(args[i])) { |
| 327 | size = Integer.parseInt(args[++i]) - 4; |
| 328 | System.out.println("Message size will be:" + (size + 4) + " bytes"); |
| 329 | } else if ("-mode".equals(args[i])) { |
| 330 | if ("receive".equals(args[++i])) { |
| 331 | send = false; |
| 332 | } |
| 333 | } else if ("-debug".equals(args[i])) { |
| 334 | debug = true; |
| 335 | } else if ("-help".equals(args[i])) { |
| 336 | usage(); |
| 337 | System.exit(1); |
| 338 | } |
| 339 | } |
| 340 | |
| 341 | ManagedChannel channel = (ManagedChannel) ChannelCreator.createChannel(args); |
| 342 | |
| 343 | LoadTest test = new LoadTest(channel, send, count, debug, pause, stats, breakOnEx); |
| 344 | test.channelOptions = channelOptions; |
| 345 | LoadMessage msg = new LoadMessage(); |
| 346 | |
| 347 | messageSize = LoadMessage.getMessageSize(msg); |
| 348 | channel.addChannelListener(test); |
nothing calls this directly
no test coverage detected