Hi all
I think I've found a bug and should be able to create a testcase for it
but wanted to ensure I'm not doing something completely wrong.
I have a HK2 Factory that is bound to create RequestScoped objects.
Everything works as expected as long as I'm using the plain synchronous
request model but when I use the async server side model my factory's
dispose method is not invoked after the request - leading to a resource
leak for the resources the factory manages.
I've dug around quite a bit and it looks as if in the async case
something obtains a reference to the RequestScoped.Instance but never
releases it again. I've found a workaround using a monitoring
RequestListener that releases the current RequestScoped instance (twice,
as I'm using up one reference in order to get access to it) for async
requests once the response is finished - this immediately triggers the
invokation of the dispose method.
This is Jersey 2.13 inside Jetty without servlets in case it matters.
Does it sound like a bug?
Stefan