try with resources in java will automatically call close().

2015-07-06 10:03 GMT+02:00 Simao Mata <simao.m...@carjump.de>:

> Hello,
>
> In the examples for the async hc version, I noticed the `close()` is always
> called after using the `CloseableHttpAsyncClient` instance, inside a
> `finally` block.
>
> I want to to reuse the `httpclient` instance, I always POST to the same
> url, so I want hc to try reusing the connection each time I call
> `.execute`. I am managing this http client instance inside an akka actor
> and I have control over the instance, so I just want to call `close` when
> the actor is restarted or stopped.
>
> What is the recommended way of handling this case? Just call `start` and
> `close` everytime I call `execute`? Or can I keep closing the connection
> only once I am really done with the client instance?
>
> Simao
>



-- 
BEKK Open
http://open.bekk.no

TesTcl - a unit test framework for iRules
http://testcl.com

Reply via email to