Re: reusable controllers and session objects
"Valeri Sarantchouk" <[email protected]>
| Newsgroups | gmane.comp.web.maverick.general |
|---|---|
| Organization | Lycos Mail (http://www.mail.lycos.com:80) |
| Message-ID | <[email protected]> |
Eelco, Do you know by any chance if it possible to have a controller which itself can be borrowed from some kind of controller factory? Similar to servlet thread pool. Thanks, Valeri --- On Sat, 29 Mar 2003 22:31:30 Eelco Hillenius wrote: >Sure, np > >If you're using ControllerSingleton (or FormBeanUser as it implements >ControllerSingleton) you should use the latest version of Maverick from CVS >as a bug that was fixed two weeks ago had the effect that >init(controllerNode) was never called for implementors of >ControllerSingleton. > >Eelco > >----- Original Message ----- >From: "Valeri Sarantchouk" <[email protected]> >To: <[email protected]> >Sent: Saturday, March 29, 2003 10:10 PM >Subject: Re: [Mav-user] reusable controllers and session objects > > >> Hi Eelco, >> >> Thank you! I took a look at Maverick's source code, and >> found it: I can simply subclass ControllerSingleton and >> use object pools from the subclass. >> >> Cheers, >> >> Valeri >> >> --- >> >> >> >> >> >> On Sat, 29 Mar 2003 21:46:42 >> Eelco Hillenius wrote: >> >I am not sure that understand you well, but... >> > >> >You can still use sessions (and all other servlet stuff) in Maverick. >Just >> >get it like getCtx().getRequest().getSession(). >> > >> >If you are working with expensive controllers (controllers that have to >do a >> >lot of initialising or have a lot of fields) you can extend >> >org.infohazard.maverick.ctl.FormBeanUser or implement >> >org.infohazard.maverick.flow.ControllerSingleton. This way, your >controllers >> >are created only once. Be sure to read the javadocs and explore the code >of >> >the org.infohazard.maverick.ctl package to clearify things ;-) >> > >> >And of course... use inheritance to factor common behaviour in your >> >controllers. As for the object pool, sure you can use whatever you think >> >suits you; Maverick won't stop you! >> > >> >Hope that helps a bit, >> > >> >Eelco >> > >> > >> >----- Original Message ----- >> >From: "Valeri Sarantchouk" <[email protected]> >> >To: <[email protected].> >> >Sent: Saturday, March 29, 2003 9:14 PM >> >Subject: [Mav-user] reusable controllers and session objects >> > >> > >> >> Dear Maverick experts, >> >> >> >> I am trying to apply Maverick to a "framework-less" web >> >> application, and my question is a very basic one. >> >> >> >> I am trying to avoid creating new objects at every request. >> >> Is it possible to use a servlet as a (Trhowaway2) >> >> Controller? Or other reusable accross requests conroller. >> >> >> >> Situation: I have a servlet that checks if there is a >> >> Client object in the user's session. If yes, the Client >> >> object is reused, otherwise a new Client instance is >> >> created. The Client object looks like this: >> >> >> >> public class Client{ >> >> >> >> private ClientModel model; >> >> private ClientModelHandler modelHandler; >> >> >> >> private CardViewHandler cardViewHandler; >> >> private FormViewHandler formViewHandler; >> >> private FormPrintHandler formPrintHandler; >> >> >> >> // methods go here... >> >> } >> >> >> >> ClientModel has 38 fields and its creation and rendering >> >> are costly operations. Plus we have at least 70 concurrent >> >> users (accessing the same view at the same time) at low >> >> periods and 350+ at high, so creating new objects for each >> >> request and passing old ones to gc doesn't look good from >> >> performace point of view. >> >> >> >> In "old" application, I use an object pool to get instances >> >> of Client objects for new users; and re-use Client objects >> >> found in user's session for logged-in users. >> >> >> >> Can you advise me on how to replicate an object pool with >> >> Maverick and how to reuse the same object found in session? >> >> >> >> Thank you very much! >> >> >> >> Valeri >> >> >> >> >> >> >> >> _____________________________________________________________ >> >> Get 25MB, POP3, Spam Filtering with LYCOS MAIL PLUS for $19.95/year. >> >> http://login.mail.lycos.com/brandPage.shtml?pageId=plus&ref=lmtplus >> >> >> >> >> >> ------------------------------------------------------- >> >> This SF.net email is sponsored by: >> >> The Definitive IT and Networking Event. Be There! >> >> NetWorld+Interop Las Vegas 2003 -- Register today! >> >> http://ads.sourceforge.net/cgi-bin/redirect.pl?keyn0001en >> >> [INVALID FOOTER] >> >> >> >> >> > >> > >> > >> >------------------------------------------------------- >> >This SF.net email is sponsored by: >> >The Definitive IT and Networking Event. Be There! >> >NetWorld+Interop Las Vegas 2003 -- Register today! >> >http://ads.sourceforge.net/cgi-bin/redirect.pl?keyn0001en >> >[INVALID FOOTER] >> > >> >> >> _____________________________________________________________ >> Get 25MB, POP3, Spam Filtering with LYCOS MAIL PLUS for $19.95/year. >> http://login.mail.lycos.com/brandPage.shtml?pageId=plus&ref=lmtplus >> >> >> ------------------------------------------------------- >> This SF.net email is sponsored by: >> The Definitive IT and Networking Event. Be There! >> NetWorld+Interop Las Vegas 2003 -- Register today! >> http://ads.sourceforge.net/cgi-bin/redirect.pl?keyn0001en >> [INVALID FOOTER] >> > > > >------------------------------------------------------- >This SF.net email is sponsored by: >The Definitive IT and Networking Event. Be There! >NetWorld+Interop Las Vegas 2003 -- Register today! >http://ads.sourceforge.net/cgi-bin/redirect.pl?keyn0001en >[INVALID FOOTER] > _____________________________________________________________ Get 25MB, POP3, Spam Filtering with LYCOS MAIL PLUS for $19.95/year. http://login.mail.lycos.com/brandPage.shtml?pageId=plus&ref=lmtplus ------------------------------------------------------- This SF.net email is sponsored by: The Definitive IT and Networking Event. Be There! NetWorld+Interop Las Vegas 2003 -- Register today! http://ads.sourceforge.net/cgi-bin/redirect.pl?keyn0001en [INVALID FOOTER]