Re: svn commit: r707569 - in /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src: main/java/org/apache/cayenne/ObjectContextStateLog.java test/java/org/apache/cayenne/remote/CayenneContextDeletionTest.java

From: Kevin Menard (nirvdru..mail.com)
Date: Fri Oct 24 2008 - 07:20:38 EDT

  • Next message: Tore Halset: "Re: svn commit: r707569 - in /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src: main/java/org/apache/cayenne/ObjectContextStateLog.java test/java/org/apache/cayenne/remote/CayenneContextDeletionTest.java"

    Just as a heads up, we can use the new Java5 concurrent classes. I
    don't think we have in the codebase, yet, but there's nothing stopping
    us from doing so. Note that I haven't really looked at the problem
    and if a Vector is the best fit, then that's fine, too.

    -- 
    Kevin
    

    On Fri, Oct 24, 2008 at 3:13 AM, <andre..pache.org> wrote:

    > Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/ObjectContextStateLog.java > URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/ObjectContextStateLog.java?rev=707569&r1=707568&r2=707569&view=diff > ============================================================================== > --- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/ObjectContextStateLog.java (original) > +++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/ObjectContextStateLog.java Fri Oct 24 00:13:36 2008 >.. -23,7 +23,9 @@ > import java.util.Collection; > import java.util.Collections; > import java.util.HashSet; > +import java.util.List; > import java.util.Set; > +import java.util.Vector; > > import org.apache.cayenne.graph.GraphChangeHandler; > import org.apache.cayenne.graph.GraphManager; >.. -52,6 +54,11 @@ > * Updates dirty objects state and clears dirty ids map. > */ > void graphCommitted() { > + /** > + * Array for deleted ids, to avoid concurrent modification > + */ > + List deletedIds = new Vector(); > + > for (Object id : dirtyIds) { > Object node = graphManager.getNode(id); > if (node instanceof Persistent) { >.. -62,11 +69,19 @@ > persistentNode.setPersistenceState(PersistenceState.COMMITTED); > break; > case PersistenceState.DELETED: > + deletedIds.add(id); > persistentNode.setPersistenceState(PersistenceState.TRANSIENT); > break; > } > } > } > + > + /** > + * Now unregister all deleted objects > + */ > + for (Object id : deletedIds) { > + graphManager.unregisterNode(id); > + } > > clear(); > }



    This archive was generated by hypermail 2.0.0 : Fri Oct 24 2008 - 07:21:17 EDT