void executeAsyncWithRetries()

in harry-core/src/harry/visitors/FaultInjectingVisitor.java [58:79]


    void executeAsyncWithRetries(CompletableFuture<Object[][]> originator, CompiledStatement statement, boolean allowFailures)
    {
        if (sut.isShutdown())
            throw new IllegalStateException("System under test is shut down");

        CompletableFuture<Object[][]> future;
        if (allowFailures && cnt.getAndIncrement() % 2 == 0)
        {
            future = sut.executeAsyncWithWriteFailure(statement.cql(), SystemUnderTest.ConsistencyLevel.QUORUM, statement.bindings());
        }
        else
        {
            future = sut.executeAsync(statement.cql(), SystemUnderTest.ConsistencyLevel.QUORUM, statement.bindings());
        }

        future.whenComplete((res, t) -> {
               if (t != null)
                   executor.schedule(() -> executeAsyncWithRetries(originator, statement, false), 1, TimeUnit.SECONDS);
               else
                   originator.complete(res);
           });
    }