diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/IngestEventsListener.java b/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/IngestEventsListener.java index 993c0c34da..cdf4d3d360 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/IngestEventsListener.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/IngestEventsListener.java @@ -52,7 +52,7 @@ public class IngestEventsListener { private static final Logger LOGGER = Logger.getLogger(EamArtifact.class.getName()); final Collection addedCeArtifactTrackerSet = new LinkedHashSet<>(); - private static long ceModuleInstanceCount = 0; + private static int ceModuleInstanceCount = 0; private final PropertyChangeListener pcl1 = new IngestModuleEventListener(); private final PropertyChangeListener pcl2 = new IngestJobEventListener(); @@ -77,7 +77,7 @@ public class IngestEventsListener { * Engine. * */ - public synchronized static void enableCorrelationEngineModule() { + public synchronized static void incrementCorrelationEngineModuleCount() { ceModuleInstanceCount++; //Should be called once in the Correlation Engine module's startup method. } @@ -85,8 +85,8 @@ public class IngestEventsListener { * Disable this IngestEventsListener from adding contents to the Correlation * Engine. */ - public synchronized static void disableCorrelationEngineModule() { - if (isCorrelationEngineModuleEnabled()) { //prevent it ingestJobCounter from going negative + public synchronized static void decrementCorrelationEngineModuleCount() { + if (getCeModuleInstanceCount()>0) { //prevent it ingestJobCounter from going negative ceModuleInstanceCount--; //Should be called once in the Correlation Engine module's shutdown method. } } @@ -105,15 +105,15 @@ public class IngestEventsListener { * * @return boolean True for Correlation Engine enabled, False for disabled */ - private synchronized static boolean isCorrelationEngineModuleEnabled() { - return ceModuleInstanceCount > 0; + private synchronized static int getCeModuleInstanceCount() { + return ceModuleInstanceCount; } private class IngestModuleEventListener implements PropertyChangeListener { @Override public void propertyChange(PropertyChangeEvent evt) { - if (isCorrelationEngineModuleEnabled()) { + if (getCeModuleInstanceCount() > 0) { EamDb dbManager; try { dbManager = EamDb.getInstance(); diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/ingestmodule/IngestModule.java b/Core/src/org/sleuthkit/autopsy/centralrepository/ingestmodule/IngestModule.java index 8f9a5ac057..1c0a66d646 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/ingestmodule/IngestModule.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/ingestmodule/IngestModule.java @@ -157,7 +157,7 @@ class IngestModule implements FileIngestModule { @Override public void shutDown() { - IngestEventsListener.disableCorrelationEngineModule(); + IngestEventsListener.decrementCorrelationEngineModuleCount(); if ((EamDb.isEnabled() == false) || (eamCase == null) || (eamDataSource == null)) { return; } @@ -191,7 +191,7 @@ class IngestModule implements FileIngestModule { }) @Override public void startUp(IngestJobContext context) throws IngestModuleException { - IngestEventsListener.enableCorrelationEngineModule(); + IngestEventsListener.incrementCorrelationEngineModuleCount(); if (EamDb.isEnabled() == false) { /* * Not throwing the customary exception for now. This is a