Enable Jest's multi-threaded support by default

Since the `JestClient` is auto-configured as a bean, it must have its
multi-threaded support enabled by default. This commit exposes a new
`spring.elasticsearch.jest.multi-threaded` property that is `true` by
default.

Closes gh-6806
This commit is contained in:
Stephane Nicoll 2016-12-27 10:46:26 +01:00
parent d0fa72a169
commit a60e356136
Notes: Phillip Webb 2016-12-27 09:38:45 -08:00
Fixes gh-7280
3 changed files with 15 additions and 0 deletions

View File

@ -81,6 +81,7 @@ public class JestAutoConfiguration {
if (gson != null) {
builder.gson(gson);
}
builder.multiThreaded(this.properties.isMultiThreaded());
return builder.connTimeout(this.properties.getConnectionTimeout())
.readTimeout(this.properties.getReadTimeout()).build();
}

View File

@ -45,6 +45,11 @@ public class JestProperties {
*/
private String password;
/**
* Enable connection requests from multiple execution threads.
*/
private boolean multiThreaded = true;
/**
* Connection timeout in milliseconds.
*/
@ -84,6 +89,14 @@ public class JestProperties {
this.password = password;
}
public boolean isMultiThreaded() {
return this.multiThreaded;
}
public void setMultiThreaded(boolean multiThreaded) {
this.multiThreaded = multiThreaded;
}
public int getConnectionTimeout() {
return this.connectionTimeout;
}

View File

@ -631,6 +631,7 @@ content into your application; rather pick only the properties that you need.
# JEST (Elasticsearch HTTP client) ({sc-spring-boot-autoconfigure}/jest/JestProperties.{sc-ext}[JestProperties])
spring.elasticsearch.jest.connection-timeout=3000 # Connection timeout in milliseconds.
spring.elasticsearch.jest.multi-threaded=true # Enable connection requests from multiple execution threads.
spring.elasticsearch.jest.password= # Login password.
spring.elasticsearch.jest.proxy.host= # Proxy host the HTTP client should use.
spring.elasticsearch.jest.proxy.port= # Proxy port the HTTP client should use.