diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/AppProperties.java b/src/main/java/ca/uhn/fhir/jpa/starter/AppProperties.java index f10f693..ed32f51 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/AppProperties.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/AppProperties.java @@ -118,6 +118,8 @@ public class AppProperties { private Map remote_terminology_service = null; private Boolean match_url_cache_enabled = false; private Boolean index_storage_optimized = false; + private Integer reindex_thread_count = null; + private Integer expunge_thread_count = null; public List getCustomInterceptorClasses() { return custom_interceptor_classes; @@ -785,6 +787,22 @@ public class AppProperties { index_storage_optimized = theIndex_storage_optimized; } + public Integer getReindex_thread_count() { + return reindex_thread_count; + } + + public void setReindex_thread_count(Integer reindex_thread_count) { + this.reindex_thread_count = reindex_thread_count; + } + + public Integer getExpunge_thread_count() { + return expunge_thread_count; + } + + public void setExpunge_thread_count(Integer expunge_thread_count) { + this.expunge_thread_count = expunge_thread_count; + } + public JpaStorageSettings.StoreMetaSourceInformationEnum getStore_meta_source_information() { return store_meta_source_information; } diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/common/FhirServerConfigCommon.java b/src/main/java/ca/uhn/fhir/jpa/starter/common/FhirServerConfigCommon.java index f28a2c6..6ca4834 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/common/FhirServerConfigCommon.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/common/FhirServerConfigCommon.java @@ -282,6 +282,21 @@ public class FhirServerConfigCommon { jpaStorageSettings.setIndexOnContainedResources(appProperties.getEnable_index_contained_resource()); jpaStorageSettings.setIndexIdentifierOfType(appProperties.getEnable_index_of_type()); + + // Configure thread counts for reindex and expunge operations + if (appProperties.getReindex_thread_count() != null) { + jpaStorageSettings.setReindexThreadCount(appProperties.getReindex_thread_count()); + ourLog.info( + "Server configured to use {} threads for reindex operations", + appProperties.getReindex_thread_count()); + } + if (appProperties.getExpunge_thread_count() != null) { + jpaStorageSettings.setExpungeThreadCount(appProperties.getExpunge_thread_count()); + ourLog.info( + "Server configured to use {} threads for expunge operations", + appProperties.getExpunge_thread_count()); + } + return jpaStorageSettings; } diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index 967ba37..af9fdcb 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -279,6 +279,11 @@ hapi: # filter_search_enabled: true # graphql_enabled: true + # Thread pool configuration for maintenance operations + # Defaults to Runtime.getRuntime().availableProcessors() if not specified + # reindex_thread_count: 4 # Number of threads to use for reindex operations + # expunge_thread_count: 4 # Number of threads to use for expunge operations + # ------------------------------------------------------------------------------- # G. Narrative & Validation # -------------------------------------------------------------------------------