diff --git a/src/main/java/org/gcube/socialnetworking/social_data_search_client/ElasticSearchClientImpl.java b/src/main/java/org/gcube/socialnetworking/social_data_search_client/ElasticSearchClientImpl.java index 194f0b0..6126d93 100644 --- a/src/main/java/org/gcube/socialnetworking/social_data_search_client/ElasticSearchClientImpl.java +++ b/src/main/java/org/gcube/socialnetworking/social_data_search_client/ElasticSearchClientImpl.java @@ -181,4 +181,12 @@ public class ElasticSearchClientImpl implements ElasticSearchClientInterface{ return response.isFound(); } + + @Override + protected void finalize() throws Throwable { + super.finalize(); + _log.info("Called finalize.. closing connection to elasticsearch"); + client.close(); + } + }