diff --git a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestDashboard.java b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestDashboard.java index 5b6c1da4b2..e6b9a474e0 100755 --- a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestDashboard.java +++ b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestDashboard.java @@ -18,7 +18,6 @@ */ package org.sleuthkit.autopsy.experimental.autoingest; -import com.google.common.util.concurrent.ThreadFactoryBuilder; import java.awt.Cursor; import java.awt.EventQueue; import java.nio.file.Path; @@ -45,8 +44,6 @@ import org.sleuthkit.autopsy.core.ServicesMonitor; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil; import org.sleuthkit.autopsy.experimental.autoingest.AutoIngestMonitor.JobsSnapshot; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; /** * A dashboard for monitoring an automated ingest cluster. @@ -75,13 +72,11 @@ public final class AutoIngestDashboard extends JPanel implements Observer { private static final int COMPLETED_TIME_COL_MIN_WIDTH = 30; private static final int COMPLETED_TIME_COL_MAX_WIDTH = 2000; private static final int COMPLETED_TIME_COL_PREFERRED_WIDTH = 280; - private static final String UPDATE_TASKS_THREAD_NAME = "AID-update-tasks-%d"; private static final Logger logger = Logger.getLogger(AutoIngestDashboard.class.getName()); private final DefaultTableModel pendingTableModel; private final DefaultTableModel runningTableModel; private final DefaultTableModel completedTableModel; private AutoIngestMonitor autoIngestMonitor; - private ExecutorService updateExecutor; /** * Creates a dashboard for monitoring an automated ingest cluster. @@ -427,20 +422,11 @@ public final class AutoIngestDashboard extends JPanel implements Observer { autoIngestMonitor = new AutoIngestMonitor(); autoIngestMonitor.addObserver(this); autoIngestMonitor.startUp(); - updateExecutor = Executors.newSingleThreadExecutor(new ThreadFactoryBuilder().setNameFormat(UPDATE_TASKS_THREAD_NAME).build()); - updateExecutor.submit(new UpdateJobsSnapshotTask()); } @Override public void update(Observable observable, Object arg) { - /* - * By creating a task to get the latest jobs snapshot, the possibility - * of queuing a refresh task for the EDT with snaphot rendered stale by - * the handling of a user prioritization action, etc. on the EDT is - * avoided. This is why the snapshot pushed ny the auto ingest jobs - * monitor is ignored. - */ - updateExecutor.submit(new UpdateJobsSnapshotTask()); + EventQueue.invokeLater(new RefreshComponentsTask((JobsSnapshot) arg)); } /** @@ -545,7 +531,7 @@ public final class AutoIngestDashboard extends JPanel implements Observer { } /* - * The enum is used in conjunction with the DefaultTableModel class to + * This enum is used in conjunction with the DefaultTableModel class to * provide table models for the JTables used to display a view of the * pending jobs queue, running jobs list, and completed jobs list for an * auto ingest cluster. The enum allows the columns of the table model to be @@ -592,23 +578,6 @@ public final class AutoIngestDashboard extends JPanel implements Observer { }; }; - /** - * A task that gets the latest auto ingest jobs snapshot from the autop - * ingest monitor and queues a components refresh task for execution in the - * EDT. - */ - private class UpdateJobsSnapshotTask implements Runnable { - - /** - * @inheritDoc - */ - @Override - public void run() { - JobsSnapshot jobsSnapshot = AutoIngestDashboard.this.autoIngestMonitor.getJobsSnapshot(); - EventQueue.invokeLater(new RefreshComponentsTask(jobsSnapshot)); - } - } - /** * A task that refreshes the UI components on this panel to reflect a * snapshot of the pending, running and completed auto ingest jobs lists of diff --git a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestMonitor.java b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestMonitor.java index 3fcc5648ba..0c0b3e3823 100755 --- a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestMonitor.java +++ b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestMonitor.java @@ -219,9 +219,8 @@ public final class AutoIngestMonitor extends Observable implements PropertyChang * @return The refreshed snapshot. */ JobsSnapshot refreshJobsSnapshot() { - JobsSnapshot newJobsSnapshot = queryCoordinationService(); synchronized (jobsLock) { - jobsSnapshot = newJobsSnapshot; + jobsSnapshot = queryCoordinationService(); return jobsSnapshot; } } @@ -283,9 +282,9 @@ public final class AutoIngestMonitor extends Observable implements PropertyChang * @param job The job to be prioritized. */ JobsSnapshot prioritizeJob(AutoIngestJob job) throws AutoIngestMonitorException { - int highestPriority = 0; - AutoIngestJob prioritizedJob = null; synchronized (jobsLock) { + int highestPriority = 0; + AutoIngestJob prioritizedJob = null; /* * Get the highest known priority and make sure the job is still in * the pending jobs queue. @@ -343,11 +342,10 @@ public final class AutoIngestMonitor extends Observable implements PropertyChang @Override public void run() { if (!Thread.currentThread().isInterrupted()) { - JobsSnapshot newJobsSnapshot = queryCoordinationService(); synchronized (jobsLock) { - jobsSnapshot = newJobsSnapshot; + jobsSnapshot = queryCoordinationService(); setChanged(); - notifyObservers(null); + notifyObservers(jobsSnapshot); } } } @@ -471,7 +469,7 @@ public final class AutoIngestMonitor extends Observable implements PropertyChang } } - + /** * Exception type thrown when there is an error completing an auto ingest * monitor operation.