@Override
    public CompletableFuture<Void> handleFailedProcess(final String oldHostId) {
        log.info("Sweeping orphaned tasks for host {}", oldHostId);
        return withRetriesAsync(() -> Futures.doWhileLoop(
                () -> postRequest(oldHostId),
                List::isEmpty, executor).whenCompleteAsync((result, ex) ->
                        log.info("Sweeping orphaned tasks for host {} complete", oldHostId), executor),
                RETRYABLE_PREDICATE, Integer.MAX_VALUE, executor);
    }
@ Override public CompletableFuture < Void > handleFailedProcess ( final String oldHostId ) { log . info ( "Sweeping orphaned tasks for host {}" , oldHostId ) ; return withRetriesAsync ( ( ) -> Futures . doWhileLoop ( ( ) -> postRequest ( oldHostId ) , List :: isEmpty , executor ) . whenCompleteAsync ( ( result , ex ) -> log . info ( "Sweeping orphaned tasks for host {} complete" , oldHostId ) , executor ) , RETRYABLE_PREDICATE , Integer . MAX_VALUE , executor ) ; }
This method is called whenever a node in the controller cluster dies. A ServerSet abstraction may be used as
a trigger to invoke this method with one of the dead hostId.
<p>
It sweeps through all unfinished tasks of failed host and attempts to execute them to completion.
@param oldHostId old host id
@return A future that completes when sweeping completes