@Test public void testInterrupt() throws Exception { prepare(new TestHandler()); LoadGenerator loadGenerator = new LoadGenerator.Builder() .port(connector.getLocalPort()) .httpClientTransportBuilder(clientTransportBuilder) .iterationsPerThread(0) .resourceRate(5) .build(); CompletableFuture<Void> cf = loadGenerator.begin(); Thread.sleep(1000); loadGenerator.interrupt(); cf.handle((r, x) -> { Throwable cause = x.getCause(); if (cause instanceof InterruptedException) { return null; } else { throw new CompletionException(cause); } }).get(5, TimeUnit.SECONDS); }
@ManagedOperation(value = "Interrupts this LoadGenerator", impact = "ACTION") public void interrupt() { interrupt = true; }
LoadGenerator extends ContainerLifeCycle { @ManagedOperation(value = "Interrupts this LoadGenerator", impact = "ACTION") public void interrupt() { interrupt = true; } }
LoadGenerator extends ContainerLifeCycle { @ManagedOperation(value = "Interrupts this LoadGenerator", impact = "ACTION") public void interrupt() { interrupt = true; } private  LoadGenerator(Config config); }
LoadGenerator extends ContainerLifeCycle { @ManagedOperation(value = "Interrupts this LoadGenerator", impact = "ACTION") public void interrupt() { interrupt = true; } private  LoadGenerator(Config config); Config getConfig(); CompletableFuture<Void> begin(); @ManagedOperation(value = "Interrupts this LoadGenerator", impact = "ACTION") void interrupt(); }
LoadGenerator extends ContainerLifeCycle { @ManagedOperation(value = "Interrupts this LoadGenerator", impact = "ACTION") public void interrupt() { interrupt = true; } private  LoadGenerator(Config config); Config getConfig(); CompletableFuture<Void> begin(); @ManagedOperation(value = "Interrupts this LoadGenerator", impact = "ACTION") void interrupt();  }