/** * @return whether the system is bootstrapped or not */ public boolean isBootstrapped() { return bootstrapStore.isBootstrapped(); }
/** * Clear bootstrap state. This should only be called in tests. */ @VisibleForTesting void clear() { Transactionals.execute(transactional, dsContext -> { MetadataStoreDataset ds = get(dsContext, datasetFramework); ds.delete(KEY); }); }
/** * 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); } }
@After public void cleanupTest() { bootstrapStore.clear(); EXECUTOR1.reset(); EXECUTOR2.reset(); EXECUTOR3.reset(); }
/** * Clear bootstrap state. This should only be called in tests. */ @VisibleForTesting void clear() { Transactionals.execute(transactional, dsContext -> { MetadataStoreDataset ds = get(dsContext, datasetFramework); ds.delete(KEY); }); }
/** * 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); } }
/** * @return whether the CDAP instance is bootstrapped. */ public boolean isBootstrapped() { return Transactionals.execute(transactional, dsContext -> { MetadataStoreDataset ds = get(dsContext, datasetFramework); return ds.exists(KEY); }); }
/** * @return whether the system is bootstrapped or not */ public boolean isBootstrapped() { return bootstrapStore.isBootstrapped(); }
/** * Mark the CDAP instance as bootstrapped. */ public void bootstrapped() { Transactionals.execute(transactional, dsContext -> { MetadataStoreDataset ds = get(dsContext, datasetFramework); ds.write(KEY, Boolean.TRUE); }); }
/** * Mark the CDAP instance as bootstrapped. */ public void bootstrapped() { Transactionals.execute(transactional, dsContext -> { MetadataStoreDataset ds = get(dsContext, datasetFramework); ds.write(KEY, Boolean.TRUE); }); }
/** * @return whether the CDAP instance is bootstrapped. */ public boolean isBootstrapped() { return Transactionals.execute(transactional, dsContext -> { MetadataStoreDataset ds = get(dsContext, datasetFramework); return ds.exists(KEY); }); }