Source:
public void started() { try { MetadataMappingService metadataMappingService = Context.getService(MetadataMappingService.class); PatientService patientService = Context.getPatientService(); FormService formService = Context.getFormService(); LocationService locationService = Context.getLocationService(); EncounterService encounterService = Context.getEncounterService(); VisitService visitService = Context.getVisitService(); AdministrationService administrationService = Context.getAdministrationService(); IdentifierSourceService identifierSourceService = Context.getService(IdentifierSourceService.class); ConceptService conceptService = Context.getService(ConceptService.class); if (config == null) { config = Context.getRegisteredComponents(Config.class).get(0); } setDispositionConfig(config); installMetadataBundles(config); setGlobalProperties(config); setExtraIdentifierTypes(metadataMappingService, patientService, config); MergeActionsSetup.registerMergeActions(); LocationTagSetup.setupLocationTags(locationService, config); HtmlFormSetup.setupHtmlFormEntryTagHandlers(); MetadataMappingsSetup.setupGlobalMetadataMappings(metadataMappingService,locationService, encounterService, visitService); MetadataMappingsSetup.setupPrimaryIdentifierTypeBasedOnCountry(metadataMappingService, patientService, config); MetadataMappingsSetup.setupFormMetadataMappings(metadataMappingService); PatientIdentifierSetup.setupIdentifierGeneratorsIfNecessary(identifierSourceService, locationService, config); PacIntegrationSetup.setup(config); AttachmentsSetup.migrateAttachmentsConceptsIfNecessary(conceptService); setupCommCareUser(); Runnable metadataSetupTask = new MetadataSetupTask(config, disableInstallMetadataBundlesThatDependOnMDSPackages); String runInSeparateThread = Context.getAdministrationService().getGlobalProperty(PihCoreConstants.GP_RUN_CONCEPT_SETUP_TASK_IN_SEPARATE_THREAD); if (StringUtils.isNotBlank(runInSeparateThread) && runInSeparateThread.toLowerCase().equals("true")) { Daemon.runInDaemonThread(metadataSetupTask, daemonToken); } else { metadataSetupTask.run(); } } catch (Exception e) { Module mod = ModuleFactory.getModuleById("pihcore"); ModuleFactory.stopModule(mod, true, true); throw new RuntimeException("failed to setup the required modules", e); } }

Target:
public void started() { try { MetadataMappingService metadataMappingService = Context.getService(MetadataMappingService.class); PatientService patientService = Context.getPatientService(); FormService formService = Context.getFormService(); LocationService locationService = Context.getLocationService(); EncounterService encounterService = Context.getEncounterService(); VisitService visitService = Context.getVisitService(); AdministrationService administrationService = Context.getAdministrationService(); IdentifierSourceService identifierSourceService = Context.getService(IdentifierSourceService.class); ConceptService conceptService = Context.getService(ConceptService.class); if (config == null) { config = Context.getRegisteredComponents(Config.class).get(0); } setDispositionConfig(config); installMetadataBundles(config); setGlobalProperties(config); setExtraIdentifierTypes(metadataMappingService, patientService, config); MergeActionsSetup.registerMergeActions(); LocationTagSetup.setupLocationTags(locationService, config); HtmlFormSetup.setupHtmlFormEntryTagHandlers(); MetadataMappingsSetup.setupGlobalMetadataMappings(metadataMappingService,locationService, encounterService, visitService); MetadataMappingsSetup.setupPrimaryIdentifierTypeBasedOnCountry(metadataMappingService, patientService, config); MetadataMappingsSetup.setupFormMetadataMappings(metadataMappingService); PatientIdentifierSetup.setupIdentifierGeneratorsIfNecessary(identifierSourceService, locationService, config); PacIntegrationSetup.setup(config); AttachmentsSetup.migrateAttachmentsConceptsIfNecessary(conceptService); setupCommCareUser(); Runnable metadataSetupTask = new MetadataSetupTask(config, testingContext); String runInSeparateThread = Context.getAdministrationService().getGlobalProperty(PihCoreConstants.GP_RUN_CONCEPT_SETUP_TASK_IN_SEPARATE_THREAD); if ("true".equalsIgnoreCase(runInSeparateThread)) { Daemon.runInDaemonThread(metadataSetupTask, daemonToken); } else { metadataSetupTask.run(); } } catch (Exception e) { Module mod = ModuleFactory.getModuleById("pihcore"); ModuleFactory.stopModule(mod, true, true); throw new RuntimeException("failed to setup the required modules", e); } }