Switched to single thread

This commit is contained in:
Eugene Livis 2019-03-13 11:01:29 -04:00
parent 6efd93636a
commit dd126a7ffe
2 changed files with 2 additions and 17 deletions

View File

@ -65,8 +65,7 @@ public class StartupWindowProvider implements StartupWindowInterface {
System.out.println("Running from command line"); System.out.println("Running from command line");
startupWindowToUse = new CommandLineStartupWindow(); startupWindowToUse = new CommandLineStartupWindow();
// kick off command line processing // kick off command line processing
CommandLineIngestManager ingestManager = new CommandLineIngestManager(); new CommandLineIngestManager().start();
ingestManager.start();
return; return;
} }

View File

@ -26,13 +26,8 @@ import java.nio.file.Path;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import java.util.Collection; import java.util.Collection;
import java.util.Iterator; import java.util.Iterator;
import java.util.concurrent.ExecutionException;
import java.util.logging.Level; import java.util.logging.Level;
import org.netbeans.spi.sendopts.OptionProcessor; import org.netbeans.spi.sendopts.OptionProcessor;
import org.openide.LifecycleManager; import org.openide.LifecycleManager;
@ -46,7 +41,6 @@ import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessorCallback
import static org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessorCallback.DataSourceProcessorResult.CRITICAL_ERRORS; import static org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessorCallback.DataSourceProcessorResult.CRITICAL_ERRORS;
import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessorProgressMonitor; import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessorProgressMonitor;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.ThreadUtils;
import org.sleuthkit.autopsy.coreutils.TimeStampUtils; import org.sleuthkit.autopsy.coreutils.TimeStampUtils;
import org.sleuthkit.autopsy.datasourceprocessors.AutoIngestDataSourceProcessor; import org.sleuthkit.autopsy.datasourceprocessors.AutoIngestDataSourceProcessor;
import org.sleuthkit.autopsy.events.AutopsyEvent; import org.sleuthkit.autopsy.events.AutopsyEvent;
@ -68,24 +62,16 @@ import org.sleuthkit.datamodel.Content;
public class CommandLineIngestManager { public class CommandLineIngestManager {
private static final Logger LOGGER = Logger.getLogger(CommandLineIngestManager.class.getName()); private static final Logger LOGGER = Logger.getLogger(CommandLineIngestManager.class.getName());
private static final String JOB_RUNNING_THREAD_NAME = "CIM-job-processing-%d";
private final ExecutorService jobProcessingExecutor;
private Future<?> jobProcessingTaskFuture;
private Path rootOutputDirectory; private Path rootOutputDirectory;
public CommandLineIngestManager() { public CommandLineIngestManager() {
jobProcessingExecutor = Executors.newSingleThreadExecutor(new ThreadFactoryBuilder().setNameFormat(JOB_RUNNING_THREAD_NAME).build());
} }
public void start() { public void start() {
JobProcessingTask jobProcessingTask = new JobProcessingTask(); new Thread(new JobProcessingTask()).start();
jobProcessingTaskFuture = jobProcessingExecutor.submit(jobProcessingTask);
} }
public void stop() { public void stop() {
ThreadUtils.shutDownTaskExecutor(jobProcessingExecutor);
try { try {
// close current case if there is one open // close current case if there is one open
Case.closeCurrentCase(); Case.closeCurrentCase();