19 package org.sleuthkit.autopsy.datasourcesummary.uiutils;
21 import java.util.ArrayList;
22 import java.util.Collections;
23 import java.util.List;
24 import java.util.concurrent.ExecutorService;
25 import java.util.concurrent.Executors;
26 import java.util.concurrent.Future;
27 import java.util.stream.Collectors;
28 import javax.swing.SwingWorker;
40 private List<? extends SwingWorker<?, ?>>
workers = Collections.emptyList();
41 private List<Future<?>>
futures = Collections.emptyList();
49 public synchronized void submit(List<? extends SwingWorker<?, ?>> submittedWorkers) {
54 if (submittedWorkers == null) {
58 this.workers =
new ArrayList<>(submittedWorkers);
61 this.futures = this.workers.stream()
62 .map((w) -> executorService.submit(w))
63 .collect(Collectors.toList());
70 futures.forEach((f) -> f.cancel(
true));
71 workers = Collections.emptyList();
72 futures = Collections.emptyList();
84 for (Future<?> future : futures) {
85 if (!future.isDone()) {
List<?extends SwingWorker<?,?> > workers
List< Future<?> > futures
synchronized void cancelRunning()
synchronized boolean isRunning()
synchronized void submit(List<?extends SwingWorker<?,?>> submittedWorkers)
final ExecutorService executorService