[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[jetty-dev] Resource leak with URLResource?
|
Hi,
I am just checking out a file handle leak with Jetty running in an OSGi
setup.
I do provide a custom "WebAppContext" which overrides getResource (…)
and returns Resource instances (created using Resource.newSource())
which are URL based and internally create a URLResource.
However doing so will cause the resources to be opened, but never closed
by the Jetty Servlet infrastructure.
I think the cause for this is in the method "URL
WebAppContext.Context.getResource(String path)". Which:
a) first it gets a resource
b) calls Resource.exists() -> which opens a stream for a URLResource
c) returns the URL by .getURL()
d) never closes the resource using Resource.close ();
This will work with FileResource instances since these implement exist
without actually opening the file. But on a URLResource most operations
do open a connection which has to be closed.
Thanks for your help
Jens