diff --git a/dmp-backend/pom.xml b/dmp-backend/pom.xml
index 335884af1..254577ace 100644
--- a/dmp-backend/pom.xml
+++ b/dmp-backend/pom.xml
@@ -69,7 +69,39 @@
org.elasticsearch
elasticsearch
- 7.6.0
+ 7.7.0
+
+
+ org.apache.httpcomponents
+ httpclient
+
+
+ org.apache.httpcomponents
+ httpcore
+
+
+ org.apache.httpcomponents
+ httpcore-nio
+
+
+
+
+
+ org.apache.httpcomponents
+ httpclient
+ 4.5.12
+
+
+
+ org.apache.httpcomponents
+ httpcore-nio
+ 4.4.13
+
+
+
+ org.apache.httpcomponents
+ httpcore
+ 4.4.13
diff --git a/dmp-backend/web/pom.xml b/dmp-backend/web/pom.xml
index 0063c90d7..d3cfd31e6 100644
--- a/dmp-backend/web/pom.xml
+++ b/dmp-backend/web/pom.xml
@@ -79,9 +79,9 @@
- postgresql
+ org.postgresql
postgresql
- 9.1-901.jdbc4
+ 42.2.22
@@ -134,6 +134,7 @@
org.apache.maven.plugins
maven-compiler-plugin
+ 3.8.1
1.8
@@ -142,6 +143,7 @@
org.springframework.boot
spring-boot-maven-plugin
+ 1.5.9.RELEASE
diff --git a/dmp-backend/web/src/main/java/eu/eudat/configurations/ElasticSearchConfiguration.java b/dmp-backend/web/src/main/java/eu/eudat/configurations/ElasticSearchConfiguration.java
index 549156f83..e299035e1 100644
--- a/dmp-backend/web/src/main/java/eu/eudat/configurations/ElasticSearchConfiguration.java
+++ b/dmp-backend/web/src/main/java/eu/eudat/configurations/ElasticSearchConfiguration.java
@@ -5,18 +5,27 @@ import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.impl.client.BasicCredentialsProvider;
+import org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager;
+import org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor;
+import org.apache.http.nio.reactor.IOReactorException;
+import org.apache.http.nio.reactor.IOReactorExceptionHandler;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
+import java.io.IOException;
+
/**
* Created by ikalyvas on 7/5/2018.
*/
@Configuration
public class ElasticSearchConfiguration {
+ private static final Logger logger = LoggerFactory.getLogger(ElasticSearchConfiguration.class);
private Environment environment;
@@ -31,12 +40,31 @@ public class ElasticSearchConfiguration {
credentialsProvider.setCredentials(AuthScope.ANY,
new UsernamePasswordCredentials(this.environment.getProperty("elasticsearch.username"), this.environment.getProperty("elasticsearch.password")));
- RestHighLevelClient client = new RestHighLevelClient(
- RestClient.builder(
- new HttpHost(this.environment.getProperty("elasticsearch.host"),
- Integer.parseInt(this.environment.getProperty("elasticsearch.port")), "http"))
- .setHttpClientConfigCallback(httpClientBuilder -> httpClientBuilder
- .setDefaultCredentialsProvider(credentialsProvider)));
- return client;
+ try {
+ DefaultConnectingIOReactor ioReactor = new DefaultConnectingIOReactor();
+ ioReactor.setExceptionHandler(new IOReactorExceptionHandler() {
+ @Override
+ public boolean handle(IOException e) {
+ logger.warn("System may be unstable: IOReactor encountered a checked exception : " + e.getMessage(), e);
+ return true; // Return true to note this exception as handled, it will not be re-thrown
+ }
+
+ @Override
+ public boolean handle(RuntimeException e) {
+ logger.warn("System may be unstable: IOReactor encountered a runtime exception : " + e.getMessage(), e);
+ return true; // Return true to note this exception as handled, it will not be re-thrown
+ }
+ });
+
+ RestHighLevelClient client = new RestHighLevelClient(
+ RestClient.builder(
+ new HttpHost(this.environment.getProperty("elasticsearch.host"),
+ Integer.parseInt(this.environment.getProperty("elasticsearch.port")), "http"))
+ .setHttpClientConfigCallback(httpClientBuilder -> httpClientBuilder
+ .setDefaultCredentialsProvider(credentialsProvider).setConnectionManager(new PoolingNHttpClientConnectionManager(ioReactor))));
+ return client;
+ }catch (IOReactorException ex) {
+ throw new RuntimeException(ex);
+ }
}
}