From: Marc P. <ma...@an...> - 2003-07-15 23:08:04
|
On Tue, 15 Jul 2003 15:59:12 -0700, Brian Goetz <br...@qu...> wrote: > The performance overhead is negligible. > > However, the issue you raise below, requiring the WM user to explicitly > free the Context is not really negligible, as the lifecycle methods at > all levels bubble up to the the level of the user's consciousness. > > So what if we add these: > > class Context { > ... > public void registerDestructor(Destructor dtor) { destructors.add(dtor); > } > public void destroy() { /* iterate through destructors */ } > } > > which don't affect anyone who's not going to use them. To be polite, we > can teach WMServlet about it. And tools that hold things like > connections should still probably use finalizers, just in case none of > the explicit mechanisms do their job. That seems OK to me. Yes, this sounds good to me too, a listener mechanism :) How about ContextDestroyListener instead of Destructor though? It's less generic but it makes the functionality clearer. Cheers -- Marc Palmer Contract Java Consultant/Developer w a n g j a m m e r s java and web software design experts with an ethical outlook http://www.wangjammers.org |