Even if the execute calls are can be minutes or even hours apart? When I
call execute I don't know when the next call will be, can be milliseconds
or hours. Should I call close anyway?

Thanks

On 6 July 2015 at 10:51, Oleg Kalnichevski <ol...@apache.org> wrote:

> On Mon, 2015-07-06 at 10:03 +0200, Simao Mata wrote:
> > 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`?
>
> No, it is not.
>
> >  Or can I keep closing the connection
> > only once I am really done with the client instance?
> >
> > Simao
>
> You should only re-use the same instance of HttpAsncClient and close it
> once done executing requests.
>
> Oleg
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
> For additional commands, e-mail: httpclient-users-h...@hc.apache.org
>
>

Reply via email to