Re: deadlock in CayenneContext.commitChanges

From: Michael Gentry (blacknex..mail.com)
Date: Fri Nov 09 2007 - 10:14:22 EST

  • Next message: Aristedes Maniatis: "Re: deadlock in CayenneContext.commitChanges"

    Well, maybe Andrus won't ...

    http://osdir.com/ml/java.cayenne.user/2006-09/msg00171.html

    "DataContext is not thread-safe, as it is intended for access by a single user.

    DataDomain and the rest of the stack underneath the DataContext is thread-safe.

    If a there is a chance of multiple threads belonging to the same user
    to access the context (and its DataObjects) simultaneously, you'll
    have to synchronize manually.

    Andrus"

    On Nov 9, 2007 9:50 AM, Michael Gentry <blacknex..mail.com> wrote:
    > I don't know this for a fact, and I'm sure Andrus will correct me, but
    > I would never have expected the DataContext to be thread-safe.
    > Perhaps that is my EOF background. I believe that doing commits (or
    > queries) from two different DataContexts is thread-safe, though.
    >
    > /dev/mrg
    >
    >
    >
    > On Nov 9, 2007 5:00 AM, Aristedes Maniatis <ar..sh.com.au> wrote:
    > > I was able to create a deadlock between two threads committing to the
    > > same context today. Cayenne as of svn trunk yesterday. Are contexts
    > > not thread-safe for writing or is this a bug?
    > >
    > >
    > > [java] -- Thread Foxtrot Single Worker Thread #3 (Id = 39) BLOCKED
    > > org.apache.cayenne.event.DispatchQueu..8c8aa
    > > [java] --
    > > org
    > > .apache.cayenne.event.DispatchQueue.dispatchEvent(DispatchQueue.java:54)
    > > [java] --
    > > org.apache.cayenne.event.EventManager.dispatchEvent(EventManager.java:
    > > 348)
    > > [java] --
    > > org.apache.cayenne.event.EventManager.postEvent(EventManager.java:319)
    > > [java] --
    > > org.apache.cayenne.remote.ClientChannel.onSync(ClientChannel.java:215)
    > > [java] --
    > > org.apache.cayenne.CayenneContext.doCommitChanges(CayenneContext.java:
    > > 249)
    > > [java] --
    > > org.apache.cayenne.CayenneContext.commitChanges(CayenneContext.java:208)
    > >
    > >
    > > [java] -- Thread AWT-EventQueue-0 (Id = 22) BLOCKED
    > > org.apache.cayenne.CayenneContextGraphManage..b0e6f
    > > [java] --
    > > org
    > > .apache
    > > .cayenne
    > > .CayenneContextMergeHandler
    > > .runWithEventsDisabled(CayenneContextMergeHandler.java:266)
    > > [java] --
    > > org
    > > .apache
    > > .cayenne
    > > .CayenneContextMergeHandler
    > > .graphFlushed(CayenneContextMergeHandler.java:81)
    > > [java] -- sun.reflect.GeneratedMethodAccessor22.invoke(Unknown Source)
    > > [java] --
    > > sun
    > > .reflect
    > > .DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
    > > 25)
    > > [java] -- java.lang.reflect.Method.invoke(Method.java:585)
    > > [java] -- org.apache.cayenne.util.Invocation.fire(Invocation.java:204)
    > > [java] -- org.apache.cayenne.event.EventManager
    > > $Dispatch.fire(EventManager.java:409)
    > > [java] --
    > > org
    > > .apache.cayenne.event.DispatchQueue.dispatchEvent(DispatchQueue.java:
    > > 162)
    > > [java] --
    > > org
    > > .apache.cayenne.event.DispatchQueue.dispatchEvent(DispatchQueue.java:58)
    > > [java] --
    > > org.apache.cayenne.event.EventManager.dispatchEvent(EventManager.java:
    > > 348)
    > > [java] --
    > > org.apache.cayenne.event.EventManager.postEvent(EventManager.java:319)
    > > [java] --
    > > org.apache.cayenne.remote.ClientChannel.onSync(ClientChannel.java:215)
    > > [java] --
    > > org.apache.cayenne.CayenneContext.doCommitChanges(CayenneContext.java:
    > > 249)
    > > [java] --
    > > org.apache.cayenne.CayenneContext.commitChanges(CayenneContext.java:208)
    > >
    > >
    > >
    > > Ari Maniatis
    > >
    > >
    > > -------------------------->
    > > ish
    > > http://www.ish.com.au
    > > Level 1, 30 Wilson Street Newtown 2042 Australia
    > > phone +61 2 9550 5001 fax +61 2 9550 4001
    > > GPG fingerprint CBFB 84B4 738D 4E87 5E5C 5EFA EF6A 7D2E 3E49 102A
    > >
    > >
    > >
    >



    This archive was generated by hypermail 2.0.0 : Fri Nov 09 2007 - 10:14:59 EST