2831 rename CE enabling methods to reflect that they are counter based

This commit is contained in:
William Schaefer 2017-09-11 18:08:04 -04:00
parent 0b02fdcf60
commit 61833ab86c
2 changed files with 9 additions and 9 deletions

View File

@ -52,7 +52,7 @@ public class IngestEventsListener {
private static final Logger LOGGER = Logger.getLogger(EamArtifact.class.getName()); private static final Logger LOGGER = Logger.getLogger(EamArtifact.class.getName());
final Collection<String> addedCeArtifactTrackerSet = new LinkedHashSet<>(); final Collection<String> addedCeArtifactTrackerSet = new LinkedHashSet<>();
private static long ceModuleInstanceCount = 0; private static int ceModuleInstanceCount = 0;
private final PropertyChangeListener pcl1 = new IngestModuleEventListener(); private final PropertyChangeListener pcl1 = new IngestModuleEventListener();
private final PropertyChangeListener pcl2 = new IngestJobEventListener(); private final PropertyChangeListener pcl2 = new IngestJobEventListener();
@ -77,7 +77,7 @@ public class IngestEventsListener {
* Engine. * Engine.
* *
*/ */
public synchronized static void enableCorrelationEngineModule() { public synchronized static void incrementCorrelationEngineModuleCount() {
ceModuleInstanceCount++; //Should be called once in the Correlation Engine module's startup method. 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 * Disable this IngestEventsListener from adding contents to the Correlation
* Engine. * Engine.
*/ */
public synchronized static void disableCorrelationEngineModule() { public synchronized static void decrementCorrelationEngineModuleCount() {
if (isCorrelationEngineModuleEnabled()) { //prevent it ingestJobCounter from going negative if (getCeModuleInstanceCount()>0) { //prevent it ingestJobCounter from going negative
ceModuleInstanceCount--; //Should be called once in the Correlation Engine module's shutdown method. 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 * @return boolean True for Correlation Engine enabled, False for disabled
*/ */
private synchronized static boolean isCorrelationEngineModuleEnabled() { private synchronized static int getCeModuleInstanceCount() {
return ceModuleInstanceCount > 0; return ceModuleInstanceCount;
} }
private class IngestModuleEventListener implements PropertyChangeListener { private class IngestModuleEventListener implements PropertyChangeListener {
@Override @Override
public void propertyChange(PropertyChangeEvent evt) { public void propertyChange(PropertyChangeEvent evt) {
if (isCorrelationEngineModuleEnabled()) { if (getCeModuleInstanceCount() > 0) {
EamDb dbManager; EamDb dbManager;
try { try {
dbManager = EamDb.getInstance(); dbManager = EamDb.getInstance();

View File

@ -157,7 +157,7 @@ class IngestModule implements FileIngestModule {
@Override @Override
public void shutDown() { public void shutDown() {
IngestEventsListener.disableCorrelationEngineModule(); IngestEventsListener.decrementCorrelationEngineModuleCount();
if ((EamDb.isEnabled() == false) || (eamCase == null) || (eamDataSource == null)) { if ((EamDb.isEnabled() == false) || (eamCase == null) || (eamDataSource == null)) {
return; return;
} }
@ -191,7 +191,7 @@ class IngestModule implements FileIngestModule {
}) })
@Override @Override
public void startUp(IngestJobContext context) throws IngestModuleException { public void startUp(IngestJobContext context) throws IngestModuleException {
IngestEventsListener.enableCorrelationEngineModule(); IngestEventsListener.incrementCorrelationEngineModuleCount();
if (EamDb.isEnabled() == false) { if (EamDb.isEnabled() == false) {
/* /*
* Not throwing the customary exception for now. This is a * Not throwing the customary exception for now. This is a