0

I've currently a piece of code which closes elastic search client when an exception is throw in the update request.

Like this:

         static Client client;
         try{
         .....async update which causes document missing

         }catch(InterruptedException|ExecutionException exception){
             client.close()
         }

But that will cause client to not available for other requests also unless instantiated again.

My question is does this clean up required on client object? Should I need to close this? Will be there be any resources intact for that failed requests if I don't close the elastic search client? Or is there any way I can make clean without needing to close the client object?

pinkpanther
  • 4,770
  • 2
  • 38
  • 62
  • Yes, you should. It should be done in the `finally` clause instead. – Maroun Jun 11 '15 at 06:11
  • 1
    @MarounMaroun no...that's a client object...not a connection object....that client is static one...which is useful for many requests...think of this way...will we clean up oracle entity manager if some query is failed? no right? – pinkpanther Jun 11 '15 at 08:22

0 Answers0