On Tue, 2015-07-28 at 22:59 +0530, Shushant Arora wrote:
> ok..
> 
> And since I am passing request object in callback handler's cosntructor so
> I am having to create a new callback object for each request instead of
> just one call back handler object.
> Say if I have million of events in 1 minute .
> Won't it lead to high memory overhead. When does the callback handler will
> be dereferenced for garbage collection?
> 
> Is there not a way to use single callback handler and somehow get the
> request url for which response came ?
> 

Dozens of intermediate objects get created in the course of of a single
request execution if you are using higher level functionality such as
authentication, redirect handling, SSL, and so on. A callback instance
per request will have no impact on garbage collection.

Generally unless one is extra careful async i/o with fewer threads
usually means higher memory consumption.

Oleg


> On Tue, Jul 28, 2015 at 6:50 PM, Oleg Kalnichevski <[email protected]> wrote:
> 
> > On Tue, 2015-07-28 at 18:44 +0530, Shushant Arora wrote:
> > > Thanks!
> > >
> > > One more doubt- I am using PoolingNHttpClientConnectionManager for
> > managing
> > > connection pool of fixed size.
> > > At each call back reponse of HttpGet Request shall I call
> > > request.releaseConnection() inside FutureCallback<HttpResponse> to
> > release
> > > connection back to pool or will it be taken back automatically ?
> > >
> >
> > That'll happen automatically. HttpUriRequest#releaseConnection() is for
> > compatibility with HttpClient 3.x and applies to blocking connections
> > only.
> >
> >
> > Oleg
> >
> >
> > >
> > > On Tue, Jul 28, 2015 at 5:45 PM, Oleg Kalnichevski <[email protected]>
> > wrote:
> > >
> > > > On Tue, 2015-07-28 at 17:42 +0530, Shushant Arora wrote:
> > > > > Thanks.
> > > > >
> > > > > Can you explain how many threads are used for callbacks when I print
> > > > thread
> > > > > name in callbacks . It prints I/O dispatcher 2 (1 to 8) for completed
> > > > > and namepool-1-thread-1 for failed callbacks . Does it internally
> > use 8
> > > > > threads for handling callbacks or is it dynamic based on some
> > calculation
> > > > > and can be overriden?
> > > > >
> > > >
> > > > HttpAsyncClient is based on HttpCore NIO. This should give an intro
> > into
> > > > the underlying NIO framework.
> > > >
> > > >
> > http://hc.apache.org/httpcomponents-core-ga/tutorial/html/nio.html#d5e477
> > > >
> > > > Oleg
> > > >
> > > > > On Tue, Jul 28, 2015 at 4:55 PM, Oleg Kalnichevski <[email protected]
> > >
> > > > wrote:
> > > > >
> > > > > > On Tue, 2015-07-28 at 16:54 +0530, Shushant Arora wrote:
> > > > > > > Hi
> > > > > > >
> > > > > > > I am using
> > org.apache.http.impl.nio.client.CloseableHttpAsyncClient
> > > > > > > (httpasyncclient-4.1.jar).
> > > > > > >
> > > > > > > In callbackof httpGet Request i.e FutureCallback<HttpResponse>
> > there
> > > > are
> > > > > > 3
> > > > > > > methods but no way to get the request context for which reponse
> > came.
> > > > > > >
> > > > > > > How can I get the request url of this reponse or some identifier
> > to
> > > > retry
> > > > > > > the request?
> > > > > > >
> > > > > > > Thanks
> > > > > >
> > > > > >
> > > > > > Nothing stops you from passing whatever context your callback
> > requires
> > > > > > at construction time.
> > > > > >
> > > > > > Oleg
> > > > > >
> > > > > >
> > > > > >
> > ---------------------------------------------------------------------
> > > > > > To unsubscribe, e-mail: [email protected]
> > > > > > For additional commands, e-mail:
> > [email protected]
> > > > > >
> > > > > >
> > > >
> > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: [email protected]
> > > > For additional commands, e-mail: [email protected]
> > > >
> > > >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [email protected]
> > For additional commands, e-mail: [email protected]
> >
> >



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to