package gov.nih.nci.cabig.caaers.service;

/**
 * Will hold the few data elements within thread scope.
 *   requirements - disable study sync during SAE - evaluate and initiate.
 */
public class ThreadScopeDataHolderService {

    private static ThreadScopeDataHolderService INSTANCE;
    private static final ThreadLocal<Boolean> SYNC_STUDY_INDICATOR = new ThreadLocal<Boolean>();

    private ThreadScopeDataHolderService() {
    }

    public static ThreadScopeDataHolderService getInstance() {
        if(INSTANCE == null) INSTANCE = new ThreadScopeDataHolderService();
        return INSTANCE;
    }
    public Boolean isStudySyncEnabled() {
        Boolean shouldSyncStudy = SYNC_STUDY_INDICATOR.get();
        return shouldSyncStudy == null || shouldSyncStudy;
    }

    public void enableStudySync() {
        SYNC_STUDY_INDICATOR.set(true);
    }

    public void disableStudySync() {
        SYNC_STUDY_INDICATOR.set(true);
    }
}

@@ -519,16 +519,30 @@
 == null)
+ %7B%0A           
  INSTANC
@@ -577,24 +577,34 @@
 rService();%0A
+        %7D%0A
         retu
@@ -937,31 +937,32 @@
 Y_INDICATOR.set(
-tru
+fals
 e);%0A    %7D%0A%7D%0A

disable - study sync in evaluateAndIntiate