We help keep things clean in the session by putting our controller in the
session and using property change / event listeners.

It's an idea that's used in game development where you have a SceneManager,
and Scenes.  The SceneManager will load a new Scene (in our case a module,
flow, page, etc), and take care of transitioning between Scenes.  So an
action may ask the SceneManager to load a new Scene, at the same time,
cleaning up the old Scene and allowing it to assert transitional flows.

The real problem comes from dumping objects all over in the session, you
should try to isolate objects in the session to one entry.  Then have
supporting methods/filters on your Actions that will scope the variables you
need for the UI.

public ActionForward startOrder(......) {
        Controller c = Controller.get(httpSession);
        OrderingContext ctx = new OrderingContext();
      ...... setup ctx

        c.loadContext(ctx);
        ..... let exceptions be thrown and caught by handlers
}

public ActionForward addItemToOrder(......) {
        Controller c = Controller.get(httpSession);
        if (c.getContext() instanceof OrderingContext) {
                User user = c.getCurrentUser();
                Account acct = c.getCurrentAccount();
                .... do some processing on orderingcontext
        } else {
                throw new OrderNotStartedException();
        }
}


Jacob Hookom
Senior Analyst
McKesson Medical-Surgical

-----Original Message-----
From: Mike Duffy [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 26, 2004 9:05 PM
To: [EMAIL PROTECTED]
Subject: Strategies for Clearing Session Objects

System performance will obviously increase if unnecessary objects are
cleared from the session.

I'd be interested in the strategies used by members of this list to clear
unnecessary objects from
the session.

I think the most basic solution is not to clutter the session in the first
place, but beyond that,
please share any specific strategies that you think are useful.

Thanks.

Mike


        
                
__________________________________
Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/ 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to