public static < X , Y > void propagateCancellation ( ListenableFuture < ? extends X > source , Future < ? extends Y > destination , boolean mayInterruptIfRunning ) { source . addListener ( ( ) -> { if ( source . isCancelled ( ) ) { destination . cancel ( mayInterruptIfRunning ) ; } } , directExecutor ( ) ) ; }
Cancels the destination Future if the source Future is cancelled .