Hi Bharath,
Thank you for the code review.
The ServerRegistry just work for calling the endpointImpl's shutdown
method when the CXFBus.shutdown is called, and ServerRegistry also
provids the Service list info for management.
I agree you to call the ServerRegistry's unregister method when the
endpointImpl's shutdown is called to avoid the ServerRegistry's memory leak.
I don't think the ThreadLocal variable will case the memory leaks.
Because it is a static variable and this variable will be set by calling
the WebserviceContextImpl's setMessageContext method.
The context will be GC if the thread is destoried or setMessageContext
is called again.
Cheers,
Willem.
Bharath Ganesh wrote:
Hi
I could see that when an endpoint is published, the corresponding org.apache.cxf.endpoint.ServerImpl instance is registered with the ServerRegistry. I wanted to know the reason for this. As far as I could not see there are no accessors for this registry.
During endpoint.stop(), the ServerImpl is not cleared from the Registry. This leads to strong reference of the ServerImpl, which would in-turn hold a reference to JaxWsEndpointImpl, the observer and all related stuff.
Also, even after stopping the endpoint (endpoint.stop() ) , if I get the list
of services (cxf/services) it still dispalys the serivce. (It cant be accessed
since there wont be any observer)
Another memory leak that I could see is in the ThreadLocal in WebserviceContextImpl. During web service invocation, the context threadlocal is set but never cleared. I think the threadlocal should be cleared at the end of invoke() method in JaxWsMethodInvoker.
Please clarify.
cheerio
Bharath