/** * Execute the steps in the loaded bootstrap config. * * @param shouldSkip predicate that determines whether to skip a step * @return the result of executing the bootstrap steps. * @throws IllegalStateException if bootstrapping is already in progress * @throws InterruptedException if bootstrapping was interrupted */ public BootstrapResult bootstrap(Predicate<BootstrapStep> shouldSkip) throws InterruptedException { List<BootstrapStepResult> results = new ArrayList<>(config.getSteps().size()); if (!bootstrapping.compareAndSet(false, true)) { throw new IllegalStateException("Bootstrap already in progress."); } try { for (BootstrapStep step : config.getSteps()) { results.add(executeStep(step, shouldSkip)); } if (!config.getSteps().isEmpty()) { bootstrapStore.bootstrapped(); } return new BootstrapResult(results); } finally { bootstrapping.set(false); } }
/** * Execute the steps in the loaded bootstrap config. * * @param shouldSkip predicate that determines whether to skip a step * @return the result of executing the bootstrap steps. * @throws IllegalStateException if bootstrapping is already in progress * @throws InterruptedException if bootstrapping was interrupted */ public BootstrapResult bootstrap(Predicate<BootstrapStep> shouldSkip) throws InterruptedException { List<BootstrapStepResult> results = new ArrayList<>(config.getSteps().size()); if (!bootstrapping.compareAndSet(false, true)) { throw new IllegalStateException("Bootstrap already in progress."); } try { for (BootstrapStep step : config.getSteps()) { results.add(executeStep(step, shouldSkip)); } if (!config.getSteps().isEmpty()) { bootstrapStore.bootstrapped(); } return new BootstrapResult(results); } finally { bootstrapping.set(false); } }