Re: Storing a copy of a DataObject in the session

From: Mike Kienenberger (mkienen..laska.net)
Date: Tue Mar 15 2005 - 15:57:12 EST

  • Next message: Joćo Paulo Vasconcellos: "Reengineer problem: ORA-00600"

    Bryan Lewis <brya..aine.rr.com> wrote:
    > > what if several people store the same object in their sessions, hmm?
    >
    > Funny you should ask that. I've been storing a DataObject in the session
    > (well, in the Tapestry visit which ends up in the session). I was storing
    > the object that represents the logged-in user. This was working fine all
    > during development, until yesterday our Q/A guy did some stress testing.
    He
    > started two sessions as the same user, by logging in from two different
    > browsers. After hitting a few big pages alternating between browsers, he
    > got weird exceptions because the user object became transient... its
    > DataContext became null.
    >
    > So... I was coming to the conclusion that I can't do that. Or else I have
    > to be very careful when the user object is retrieved, and be prepared to
    > re-fetch or re-register it. Is that a good enough fix? Maybe I should
    > store only the user ID and _always_ refetch it? That seems kind of
    wasteful
    > since the object is used on almost every page and double logins will be
    > rare.
    >
    > While looking for a small test case, I noticed that the new "Tapestry
    Blog"
    > example follows this technique -- the Visit stores a UserAccount object.

    Actually, your problem above was probably caused by the error stated in
    CAY-256

    http://objectstyle.org/jira/secure/ViewIssue.jspa?key=CAY-256

    A refetch or invalidate in another context probably disassociated your
    object from your context.

    -Mike



    This archive was generated by hypermail 2.0.0 : Tue Mar 15 2005 - 15:56:03 EST