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());
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 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();

View File

@ -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