OutOfMemory in HttpClient

Trustin Lee trustin at gleamynode.net
Tue Jan 20 14:07:28 EST 2009


On Tue, Jan 20, 2009 at 6:50 PM, jaimemm <jaimemm at gmail.com> wrote:
> I was just working on that. If I share the factory the threads number keeps
> stable, so the memory.

Good to hear that you sorted out the problem. :)

> But still, just in case I'd like to create a new factory per request, should
> be possible to release the resources (free the threads) from the
> ResponseHandler. Am I wrong?

I would avoid to call releaseExternalResources() in a ChannelHandler
because it's a highway to a dead lock.  You need to do that outside of
a ChannelHandler.  Also, please note that starting a ChannelFactory
and stopping it take relatively large amount of time.  I'd always
prefer to use only one ChannelFactory instance.  You can group the
channels using ChannelGroup (in org.jboss.netty.channel.group) in
whatever way you want.

HTH,

— Trustin Lee, http://gleamynode.net/




More information about the netty-users mailing list