Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] New HttpClient holds resources


On Mon, Dec 31, 2012 at 7:09 PM, ccleve <> wrote:
> I'm writing code that uses the new Jetty 9 HttpClient. Unfortunately, you
> have to start() it and later stop() it, else it holds resources and doesn't
> let the JVM stop. (I assume it's got some threads still running internally.)
> Is this really necessary?

The lifecycle, i.e. calling start() and stop(), is necessary because
HttpClient pools connections for performance reasons, and coordinates
a number of other components that have the same lifecycle.
This is a good practice that is used throughout any threaded
component, outside Jetty too.

> Or is it an essential element in an Async NIO
> implementation?
> I'm concerned about resource leaks.

What resource leaks ?

If you stop() HttpClient, it should release all resources.

Developer advice, training, services and support
from the Jetty & CometD experts.
Finally, no matter how good the architecture and design are,
to deliver bug-free software with optimal performance and reliability,
the implementation technique must be flawless.   Victoria Livschitz

Back to the top