Re: Obtaining DataContext in ZK

From: Tore Halset (halse..vv.ntnu.no)
Date: Wed May 23 2007 - 04:23:59 EDT

  • Next message: Andrus Adamchik: "Re: Obtaining DataContext in ZK"

    Hello.

    The DataContext are not thread-safe so you may experience random
    problems if your app has a single DC used by two different threads.

    There are different ways to "solve" this issue.
      A) Make sure each session only have one request at any time. See
    http://tinyurl.com/2r4kcy
      B) Use a single DC for each thread. session bound data objects must
    then be transferred using localObject() between contexts. Or just
    store the objects ObjectId in the session.
      C) Use child DC or peer DC. I have not tried this approach.

    I am sure someone else can come up with other variants.

    Regards,
      - Tore.

    On May 23, 2007, at 03:30, Steve Wells wrote:

    > I guess the result could be hard to predict and test? Are you
    > suggesting
    > that I should wrap the block of dc == null {...} in a synchronized()?
    >
    > Clearly my knowledge of this area is limited and I do appreciate your
    > guidance and questions.
    >
    > Steve
    >
    > On 23/05/07, Tore Halset <halse..vv.ntnu.no> wrote:
    >>
    >> On May 22, 2007, at 05:22, Steve Wells wrote:
    >>
    >> > My approach would be to have a simple per session DC and a global
    >> > web app
    >> > one...at this stage, hardly seems dangerous, what could possibly go
    >> > wrong?
    >> > ;)
    >>
    >> What if a user (session) issues two simultanous requests?
    >>
    >> - Tore.
    >>



    This archive was generated by hypermail 2.0.0 : Wed May 23 2007 - 04:23:22 EDT