Can we keep the rest client alive through out the application life cycle. or do we need to close the client after each request.
final RestClient restClient = RestClient.builder(new HttpHost("localhost", 9200, "http")).build();
public void onSuccess(Response response) {
try {
System.out.println(EntityUtils.toString(response.getEntity()));
} catch (ParseException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try {
restClient.close(); -- Does this need to happen
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}