RE: webapp design question
Thelmo Loisio <[email protected]>
| Newsgroups | gmane.comp.java.enhydra.barracuda.general |
|---|---|
| Message-ID | <[email protected]> |
First of all thanks to you and Jacob for answering me in a so precise manner. On Fri, 2003-10-24 at 03:07, Christian Cryder wrote: > Hi Thelmo, > > Ok, so as Jake has already noted, the ObjectRepository provides an alternate > interface for putting data in the Session, but you may want to be careful > how much stuff you put in there as that will definitely increase the > footprint and reduce scalability of the app. A general principle is that you > want to put as little as possible in the session - and if you do have some > objects that you want to store there for convenience/performance purposes, > you may want to store them as "soft" or "weak" objects, allowing them to be > gc'd if the JVM starts to run low on memory. Barracuda's ObjectRepository > can help here too with its cache repository. I've already read the quote about not putting so much stuff within HttpSession for maintain scalability but... isn't true that when a session expire all the stuff within get gc'd !? Anyway i've looked at javadocs about soft and weak implementation and that's look promising... for my needs. > > Here's an overview of what the ObjectRepository class gives you - > > There are 3 "global" repositories - [..] > Likewise, there are 3 "session" repositories that are basically the same as > the global repositories, except they are scoped to session - [..] > Next you have a "local" respository - [..] > The local that is scoped within the http request/response cycle - anything > you put in here (ie. in a request handler) will be available to all other > portions of your code (ie. in a response handler, internal data layer > objects, etc). In other words, any code executed within the same thread are > going to have access to objects in this repository. And any objects placed > in this repository are automatically removed at the end of the req/resp > cycle - so you don't have to worry about cleaning things up (unlike global, > session, or other repositories). So this mean that if i don't use soft or weak within global and especially session repositories all the stuff in that is never gc'd ? And if i understand correctly if it set someting in the local repository within a handleControlEvent(ControlEventContext) method i get it in the handlViewEvent(ViewEventContext) one !? Since i don't send/write the HtppResponse ... right !? > Finally, there is a method that allows you to get "regular" repositories > using a Namespace or String naming convention - allowing you to set up your [..] > Ok, so now on to the next question: why use the ObjectRepository structure [..] > non-servlet environments. That's pretty useful. That's sounds very powerful ... > Finally, the ObjectRepository approach also gives you the ability to script [..] > building webapps without it. I definitely have to study and learn it deep. > Does that help explain things a bit? Sure and for that tanks again, but now i would like to ask one more (little) thing ;) In the event-gateway.xml file there's a way to specify which handler within a factory is interested in which event ? I would like to get the same behavior as with this (for ex): specifyLocalEventInterests(new EventConnectorFactory(Handler.class), Event.class); Best regards. -- Thelmo