public PipelineStageBeans duplicatePipelineStageBeans ( StageLibraryTask stageLib , PipelineStageBeans pipelineStageBeans , InterceptorCreatorContextBuilder interceptorCreatorContextBuilder , Map < String , Object > constants , List < Issue > errors ) { List < StageBean > stageBeans = new ArrayList <> ( pipelineStageBeans . size ( ) ) ; for ( StageBean original : pipelineStageBeans . getStages ( ) ) { // Create StageDefinition map for this stage Map < Class , ServiceDefinition > services = original . getServices ( ) . stream ( ) . collect ( Collectors . toMap ( c -> c . getDefinition ( ) . getProvides ( ) , ServiceBean :: getDefinition ) ) ; StageBean stageBean = createStage ( stageLib , original . getDefinition ( ) , ClassLoaderReleaser . NOOP_RELEASER , original . getConfiguration ( ) , services :: get , interceptorCreatorContextBuilder , constants , errors ) ; if ( stageBean != null ) { stageBeans . add ( stageBean ) ; } } return new PipelineStageBeans ( stageBeans ) ; }
Creates additional PipelineStageBeans for additional runners . Stages will share stage definition and thus class loader with the first given runner . That includes stages with private class loader as well .