hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Magnus Landrø <stefan.lan...@gmail.com>
Subject Re: Releasing resources when using CloseableHttpAsyncClient
Date Mon, 06 Jul 2015 08:31:30 GMT
https://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html

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

> Sorry, I don't understand what you mean?
>
> On 6 July 2015 at 10:17, Stefan Magnus Landrø <stefan.landro@gmail.com>
> wrote:
>
> > try with resources in java will automatically call close().
> >
> >
> > 2015-07-06 10:03 GMT+02:00 Simao Mata <simao.mata@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
> >
>



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

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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message