public void forEach ( ThrowingConsumer < Pipe > consumer ) { try { MDC . put ( LogConstants . RUNNER , String . valueOf ( runnerId ) ) ; try { for ( Pipe p : pipes ) { MDC . put ( LogConstants . STAGE , p . getStage ( ) . getInfo ( ) . getInstanceName ( ) ) ; acceptConsumer ( consumer , p ) ; } } finally { MDC . put ( LogConstants . RUNNER , "" ) ; MDC . put ( LogConstants . STAGE , "" ) ; } } catch ( PipelineException | StageException e ) { throw new RuntimeException ( e ) ; } }
Execute given consumer for each pipe rethrowing usual exceptions as RuntimeException .