added finalize method to close connection to elasticsearch when this instance is no longer needed

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/social-networking/social-data-search-client@130208 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2016-07-09 20:32:17 +00:00
parent 1816fa42bc
commit fcde545ef5
1 changed files with 8 additions and 0 deletions

View File

@ -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();
}
}