consensus-core/src/test/java/com/mboysan/consensus/util/MultiThreadExecutor.java
/**
     * Waits for all the executions to complete.
     * @throws InterruptedException if latch await fails.
     */
Waits for all the executions to complete.
@throws InterruptedException if latch await fails.
Waits for all the executions to complete . @throws InterruptedException if latch await fails .
public void endExecution() throws InterruptedException, ExecutionException {
        LOGGER.info("ending execution id=" + execId);
        latch.countDown();
        for (Future<Optional<Exception>> future : futures) {
            Optional<Exception> optEx = future.get();
            optEx.ifPresent(e -> fail(String.format("execution[id=%s] failed with exception=%s", execId, e)));
        }
        executor.shutdown();
        LOGGER.info("execution[id={}] ended successfully.", execId);
    }
public void endExecution ( ) throws InterruptedException , ExecutionException { LOGGER . info ( "ending execution id=" + execId ) ; latch . countDown ( ) ; for ( Future < Optional < Exception > > future : futures ) { Optional < Exception > optEx = future . get ( ) ; optEx . ifPresent ( e -> fail ( String . format ( "execution[id=%s] failed with exception=%s" , execId , e ) ) ) ; } executor . shutdown ( ) ; LOGGER . info ( "execution[id={}] ended successfully." , execId ) ; }
Waits for all the executions to complete.
Waits for all the executions to complete .