/** * Cancels any construction threads. If background threads had been started for graph * construction, they will be stopped and the construction abandoned. Note that this will also * reset the number of additional threads to zero to prevent further threads from being started by * the existing ones before they terminate. If a thread is already blocked in a call to {@link * #getDependencyGraph} it will receive a {@link CancellationException} unless the graph * construction completes before the cancellation is noted by that or other background threads. * The cancellation is temporary, the additional threads can be reset afterwards for continued * background building or a subsequent call to getDependencyGraph can finish the work. * * @param mayInterruptIfRunning ignored * @return true if the build was cancelled */ @Override public boolean cancel(final boolean mayInterruptIfRunning) { setMaxAdditionalThreads(0); synchronized (_activeJobs) { _cancelled = true; for (final Job job : _activeJobs) { job.cancel(true); } _activeJobs.clear(); } return true; }
protected void configureBuilder(final DependencyGraphBuilder builder) { builder.setMaxAdditionalThreads(getMaxAdditionalThreadsPerBuilder()); }