public void requestCancellation ( ) { Collection < CompletableFuture < ? > > toInvoke ; synchronized ( this . futures ) { this . cancellationRequested = true ; toInvoke = new ArrayList <> ( this . futures ) ; } toInvoke . forEach ( f -> f . cancel ( true ) ) ; synchronized ( this . futures ) { this . futures . clear ( ) ; } }
Cancels all registered futures .