add executorService config

This commit is contained in:
justin.mckelvy 2023-05-15 21:46:49 -06:00
parent 05defb58c5
commit b41c96f259
2 changed files with 16 additions and 0 deletions

View File

@ -74,12 +74,15 @@ import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.Primary;
import org.springframework.context.annotation.Scope;
import org.springframework.security.concurrent.DelegatingSecurityContextExecutor;
import org.springframework.security.concurrent.DelegatingSecurityContextExecutorService;
import org.springframework.security.core.context.SecurityContextHolder;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ForkJoinPool;
@ -303,6 +306,13 @@ public abstract class BaseClinicalReasoningConfig {
SecurityContextHolder.getContext());
}
@Bean
public ExecutorService measureExecutor() {
ExecutorService executor = Executors.newFixedThreadPool(CrProperties.MeasureProperties.DEFAULT_THREADS_BATCH_SIZE);
executor = new DelegatingSecurityContextExecutorService(executor);
return executor;
}
@Bean
public PreExpandedValidationSupportLoader preExpandedValidationSupportLoader(ValidationSupportChain theSupportChain,
FhirContext theFhirContext) {

View File

@ -63,6 +63,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import static ca.uhn.fhir.cr.constant.MeasureReportConstants.COUNTRY_CODING_SYSTEM_CODE;
import static ca.uhn.fhir.cr.constant.MeasureReportConstants.MEASUREREPORT_MEASURE_SUPPLEMENTALDATA_EXTENSION;
@ -141,6 +142,9 @@ public class MeasureService implements IDaoRegistryUser {
@Autowired
protected DaoRegistry myDaoRegistry;
@Autowired
private ExecutorService myMeasureExecutor;
protected RequestDetails myRequestDetails;
public RequestDetails getRequestDetails() {
@ -194,6 +198,8 @@ public class MeasureService implements IDaoRegistryUser {
TerminologyProvider terminologyProvider;
myMeasureEvaluationOptions.setMeasureExecutor(myMeasureExecutor);
if (theTerminologyEndpoint != null) {
IGenericClient client = Clients.forEndpoint(getFhirContext(), theTerminologyEndpoint);
terminologyProvider = new R4FhirTerminologyProvider(client);