Merge pull request #215 from xluanlhc/search-coord-thread-pool
Elastic rest_url parsing fix and a few additional configuration parameters
This commit is contained in:
@@ -68,6 +68,9 @@ public class AppProperties {
|
|||||||
private Boolean lastn_enabled = false;
|
private Boolean lastn_enabled = false;
|
||||||
private NormalizedQuantitySearchLevel normalized_quantity_search_level = NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_NOT_SUPPORTED;
|
private NormalizedQuantitySearchLevel normalized_quantity_search_level = NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_NOT_SUPPORTED;
|
||||||
|
|
||||||
|
private Integer search_coord_core_pool_size = 20;
|
||||||
|
private Integer search_coord_max_pool_size = 100;
|
||||||
|
private Integer search_coord_queue_capacity = 200;
|
||||||
private Boolean use_apache_address_strategy = false;
|
private Boolean use_apache_address_strategy = false;
|
||||||
private Boolean use_apache_address_strategy_https = false;
|
private Boolean use_apache_address_strategy_https = false;
|
||||||
|
|
||||||
@@ -450,6 +453,23 @@ public class AppProperties {
|
|||||||
this.normalized_quantity_search_level = normalized_quantity_search_level;
|
this.normalized_quantity_search_level = normalized_quantity_search_level;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Integer getSearch_coord_core_pool_size() { return search_coord_core_pool_size; }
|
||||||
|
|
||||||
|
public void setSearch_coord_core_pool_size(Integer search_coord_core_pool_size) {
|
||||||
|
this.search_coord_core_pool_size = search_coord_core_pool_size;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getSearch_coord_max_pool_size() { return search_coord_max_pool_size; }
|
||||||
|
|
||||||
|
public void setSearch_coord_max_pool_size(Integer search_coord_max_pool_size) {
|
||||||
|
this.search_coord_max_pool_size = search_coord_max_pool_size;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getSearch_coord_queue_capacity() { return search_coord_queue_capacity; }
|
||||||
|
|
||||||
|
public void setSearch_coord_queue_capacity(Integer search_coord_queue_capacity) {
|
||||||
|
this.search_coord_queue_capacity = search_coord_queue_capacity;
|
||||||
|
}
|
||||||
|
|
||||||
public static class Cors {
|
public static class Cors {
|
||||||
private Boolean allow_Credentials = true;
|
private Boolean allow_Credentials = true;
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import org.springframework.core.env.ConfigurableEnvironment;
|
|||||||
import org.springframework.orm.jpa.JpaTransactionManager;
|
import org.springframework.orm.jpa.JpaTransactionManager;
|
||||||
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
|
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
import javax.persistence.EntityManagerFactory;
|
import javax.persistence.EntityManagerFactory;
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
@@ -31,6 +32,19 @@ public class FhirServerConfigDstu2 extends BaseJavaConfigDstu2 {
|
|||||||
@Autowired
|
@Autowired
|
||||||
AppProperties appProperties;
|
AppProperties appProperties;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void initSettings() {
|
||||||
|
if(appProperties.getSearch_coord_core_pool_size() != null) {
|
||||||
|
setSearchCoordCorePoolSize(appProperties.getSearch_coord_core_pool_size());
|
||||||
|
}
|
||||||
|
if(appProperties.getSearch_coord_max_pool_size() != null) {
|
||||||
|
setSearchCoordMaxPoolSize(appProperties.getSearch_coord_max_pool_size());
|
||||||
|
}
|
||||||
|
if(appProperties.getSearch_coord_queue_capacity() != null) {
|
||||||
|
setSearchCoordQueueCapacity(appProperties.getSearch_coord_queue_capacity());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DatabaseBackedPagingProvider databaseBackedPagingProvider() {
|
public DatabaseBackedPagingProvider databaseBackedPagingProvider() {
|
||||||
DatabaseBackedPagingProvider pagingProvider = super.databaseBackedPagingProvider();
|
DatabaseBackedPagingProvider pagingProvider = super.databaseBackedPagingProvider();
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import org.springframework.core.env.ConfigurableEnvironment;
|
|||||||
import org.springframework.orm.jpa.JpaTransactionManager;
|
import org.springframework.orm.jpa.JpaTransactionManager;
|
||||||
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
|
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
import javax.persistence.EntityManagerFactory;
|
import javax.persistence.EntityManagerFactory;
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
@@ -29,6 +30,20 @@ public class FhirServerConfigDstu3 extends BaseJavaConfigDstu3 {
|
|||||||
@Autowired
|
@Autowired
|
||||||
AppProperties appProperties;
|
AppProperties appProperties;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void initSettings() {
|
||||||
|
if(appProperties.getSearch_coord_core_pool_size() != null) {
|
||||||
|
setSearchCoordCorePoolSize(appProperties.getSearch_coord_core_pool_size());
|
||||||
|
}
|
||||||
|
if(appProperties.getSearch_coord_max_pool_size() != null) {
|
||||||
|
setSearchCoordMaxPoolSize(appProperties.getSearch_coord_max_pool_size());
|
||||||
|
}
|
||||||
|
if(appProperties.getSearch_coord_queue_capacity() != null) {
|
||||||
|
setSearchCoordQueueCapacity(appProperties.getSearch_coord_queue_capacity());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DatabaseBackedPagingProvider databaseBackedPagingProvider() {
|
public DatabaseBackedPagingProvider databaseBackedPagingProvider() {
|
||||||
DatabaseBackedPagingProvider pagingProvider = super.databaseBackedPagingProvider();
|
DatabaseBackedPagingProvider pagingProvider = super.databaseBackedPagingProvider();
|
||||||
@@ -68,7 +83,12 @@ public class FhirServerConfigDstu3 extends BaseJavaConfigDstu3 {
|
|||||||
public ElasticsearchSvcImpl elasticsearchSvc() {
|
public ElasticsearchSvcImpl elasticsearchSvc() {
|
||||||
if (EnvironmentHelper.isElasticsearchEnabled(configurableEnvironment)) {
|
if (EnvironmentHelper.isElasticsearchEnabled(configurableEnvironment)) {
|
||||||
String elasticsearchUrl = EnvironmentHelper.getElasticsearchServerUrl(configurableEnvironment);
|
String elasticsearchUrl = EnvironmentHelper.getElasticsearchServerUrl(configurableEnvironment);
|
||||||
String elasticsearchHost = elasticsearchUrl.substring(elasticsearchUrl.indexOf("://")+3, elasticsearchUrl.lastIndexOf(":"));
|
String elasticsearchHost;
|
||||||
|
if (elasticsearchUrl.startsWith("http")) {
|
||||||
|
elasticsearchHost = elasticsearchUrl.substring(elasticsearchUrl.indexOf("://") + 3, elasticsearchUrl.lastIndexOf(":"));
|
||||||
|
} else {
|
||||||
|
elasticsearchHost = elasticsearchUrl.substring(0, elasticsearchUrl.indexOf(":"));
|
||||||
|
}
|
||||||
String elasticsearchUsername = EnvironmentHelper.getElasticsearchServerUsername(configurableEnvironment);
|
String elasticsearchUsername = EnvironmentHelper.getElasticsearchServerUsername(configurableEnvironment);
|
||||||
String elasticsearchPassword = EnvironmentHelper.getElasticsearchServerPassword(configurableEnvironment);
|
String elasticsearchPassword = EnvironmentHelper.getElasticsearchServerPassword(configurableEnvironment);
|
||||||
int elasticsearchPort = Integer.parseInt(elasticsearchUrl.substring(elasticsearchUrl.lastIndexOf(":")+1));
|
int elasticsearchPort = Integer.parseInt(elasticsearchUrl.substring(elasticsearchUrl.lastIndexOf(":")+1));
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import org.springframework.core.env.ConfigurableEnvironment;
|
|||||||
import org.springframework.orm.jpa.JpaTransactionManager;
|
import org.springframework.orm.jpa.JpaTransactionManager;
|
||||||
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
|
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
import javax.persistence.EntityManagerFactory;
|
import javax.persistence.EntityManagerFactory;
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
@@ -31,6 +32,19 @@ public class FhirServerConfigR4 extends BaseJavaConfigR4 {
|
|||||||
@Autowired
|
@Autowired
|
||||||
AppProperties appProperties;
|
AppProperties appProperties;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void initSettings() {
|
||||||
|
if(appProperties.getSearch_coord_core_pool_size() != null) {
|
||||||
|
setSearchCoordCorePoolSize(appProperties.getSearch_coord_core_pool_size());
|
||||||
|
}
|
||||||
|
if(appProperties.getSearch_coord_max_pool_size() != null) {
|
||||||
|
setSearchCoordMaxPoolSize(appProperties.getSearch_coord_max_pool_size());
|
||||||
|
}
|
||||||
|
if(appProperties.getSearch_coord_queue_capacity() != null) {
|
||||||
|
setSearchCoordQueueCapacity(appProperties.getSearch_coord_queue_capacity());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DatabaseBackedPagingProvider databaseBackedPagingProvider() {
|
public DatabaseBackedPagingProvider databaseBackedPagingProvider() {
|
||||||
DatabaseBackedPagingProvider pagingProvider = super.databaseBackedPagingProvider();
|
DatabaseBackedPagingProvider pagingProvider = super.databaseBackedPagingProvider();
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import org.springframework.core.env.ConfigurableEnvironment;
|
|||||||
import org.springframework.orm.jpa.JpaTransactionManager;
|
import org.springframework.orm.jpa.JpaTransactionManager;
|
||||||
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
|
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
import javax.persistence.EntityManagerFactory;
|
import javax.persistence.EntityManagerFactory;
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
@@ -32,6 +33,19 @@ public class FhirServerConfigR5 extends BaseJavaConfigR5 {
|
|||||||
@Autowired
|
@Autowired
|
||||||
AppProperties appProperties;
|
AppProperties appProperties;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void initSettings() {
|
||||||
|
if(appProperties.getSearch_coord_core_pool_size() != null) {
|
||||||
|
setSearchCoordCorePoolSize(appProperties.getSearch_coord_core_pool_size());
|
||||||
|
}
|
||||||
|
if(appProperties.getSearch_coord_max_pool_size() != null) {
|
||||||
|
setSearchCoordMaxPoolSize(appProperties.getSearch_coord_max_pool_size());
|
||||||
|
}
|
||||||
|
if(appProperties.getSearch_coord_queue_capacity() != null) {
|
||||||
|
setSearchCoordQueueCapacity(appProperties.getSearch_coord_queue_capacity());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DatabaseBackedPagingProvider databaseBackedPagingProvider() {
|
public DatabaseBackedPagingProvider databaseBackedPagingProvider() {
|
||||||
DatabaseBackedPagingProvider pagingProvider = super.databaseBackedPagingProvider();
|
DatabaseBackedPagingProvider pagingProvider = super.databaseBackedPagingProvider();
|
||||||
@@ -71,7 +85,12 @@ public class FhirServerConfigR5 extends BaseJavaConfigR5 {
|
|||||||
public ElasticsearchSvcImpl elasticsearchSvc() {
|
public ElasticsearchSvcImpl elasticsearchSvc() {
|
||||||
if (EnvironmentHelper.isElasticsearchEnabled(configurableEnvironment)) {
|
if (EnvironmentHelper.isElasticsearchEnabled(configurableEnvironment)) {
|
||||||
String elasticsearchUrl = EnvironmentHelper.getElasticsearchServerUrl(configurableEnvironment);
|
String elasticsearchUrl = EnvironmentHelper.getElasticsearchServerUrl(configurableEnvironment);
|
||||||
String elasticsearchHost = elasticsearchUrl.substring(elasticsearchUrl.indexOf("://")+3, elasticsearchUrl.lastIndexOf(":"));
|
String elasticsearchHost;
|
||||||
|
if (elasticsearchUrl.startsWith("http")) {
|
||||||
|
elasticsearchHost = elasticsearchUrl.substring(elasticsearchUrl.indexOf("://") + 3, elasticsearchUrl.lastIndexOf(":"));
|
||||||
|
} else {
|
||||||
|
elasticsearchHost = elasticsearchUrl.substring(0, elasticsearchUrl.indexOf(":"));
|
||||||
|
}
|
||||||
String elasticsearchUsername = EnvironmentHelper.getElasticsearchServerUsername(configurableEnvironment);
|
String elasticsearchUsername = EnvironmentHelper.getElasticsearchServerUsername(configurableEnvironment);
|
||||||
String elasticsearchPassword = EnvironmentHelper.getElasticsearchServerPassword(configurableEnvironment);
|
String elasticsearchPassword = EnvironmentHelper.getElasticsearchServerPassword(configurableEnvironment);
|
||||||
int elasticsearchPort = Integer.parseInt(elasticsearchUrl.substring(elasticsearchUrl.lastIndexOf(":")+1));
|
int elasticsearchPort = Integer.parseInt(elasticsearchUrl.substring(elasticsearchUrl.lastIndexOf(":")+1));
|
||||||
|
|||||||
@@ -6,6 +6,10 @@ spring:
|
|||||||
password: null
|
password: null
|
||||||
driverClassName: org.h2.Driver
|
driverClassName: org.h2.Driver
|
||||||
max-active: 15
|
max-active: 15
|
||||||
|
|
||||||
|
# database connection pool size
|
||||||
|
hikari:
|
||||||
|
maximum-pool-size: 10
|
||||||
jpa:
|
jpa:
|
||||||
properties:
|
properties:
|
||||||
hibernate.format_sql: false
|
hibernate.format_sql: false
|
||||||
@@ -90,6 +94,11 @@ hapi:
|
|||||||
# allowed_origin:
|
# allowed_origin:
|
||||||
# - '*'
|
# - '*'
|
||||||
|
|
||||||
|
# Search coordinator thread pool sizes
|
||||||
|
search-coord-core-pool-size: 20
|
||||||
|
search-coord-max-pool-size: 100
|
||||||
|
search-coord-queue-capacity: 200
|
||||||
|
|
||||||
# logger:
|
# logger:
|
||||||
# error_format: 'ERROR - ${requestVerb} ${requestUrl}'
|
# error_format: 'ERROR - ${requestVerb} ${requestUrl}'
|
||||||
# format: >-
|
# format: >-
|
||||||
|
|||||||
Reference in New Issue
Block a user