Thanks for this fix to discard(). I'm the developer that originally encouraged Jeff to add in this feature. I'm really glad you found this leak -- The fix has also proved really important in the application I'm working on to "clean up" -- I was also running out of resources without this.
Thanks,
Dan
At 02:59 PM 12/4/02 +0200, you wrote:
I think that Maverick should guarantee that discard() method of ModelLifetime implementing classes get's called whatever happens during rendering view or executing command.Here is my modifications to CommandBase class go() method: /** * Execute the command and render the results! */ public void go(MaverickContext mctx) throws IOException, ServletException { try { // There must be a controller class to distinguish between views String viewName = this.controller.go(mctx); log.info("Switching to view: " + viewName); View target = (View)this.getView(viewName); if (null == target) throw new ServletException("Controller specified view \"" + viewName + "\", but no view with that name is defined."); target.go(mctx); } finally { // Allow the model to manage resources if (mctx.getModel() instanceof ModelLifetime) ((ModelLifetime)mctx.getModel()).discard(); } } Why I need this? I use hibernate and I also want to use lazy collections. I open hibernate session in Command execution and leave connections open. When view is rendered I want to be sure that discard() method gets called so I can be sure that connections are released to the pool and hibernate Session gets closed. Without this modification it is not guaranteed that discard() method get's called (e.g. in case of exception in view rendering or command execution. Kind Regards Aapo Laakkonen ------------------------------------------------------- This SF.net email is sponsored by: Microsoft Visual Studio.NET comprehensive development tool, built to increase your productivity. Try a free online hosted session at: http://ads.sourceforge.net/cgi-bin/redirect.pl?micr0003en [INVALID FOOTER]
-------------------------------------------------------
This sf.net email is sponsored by:
With Great Power, Comes Great Responsibility Learn to use your power at OSDN's High Performance Computing Channel
http://hpc.devchannel.org/
[INVALID FOOTER]
