ConcurrentModificationException ...

From: Arnaud GARCIA (arnaud.garci..im.hcuge.ch)
Date: Mon Apr 24 2006 - 10:56:40 EDT

  • Next message: Cris Daniluk: "Re: ConcurrentModificationException ..."

    Hello,
    I have a problem with multithreaded access with cayenne ...
    My model is a simple one to many relationship (an Order can have many
    series)

    In my main thread I add new series to an Order :
            order.addToSeries(aSerie);

    But in another thread I am doing an Iteration over the series which
    launch an exception:
            List series = order.getSeries();
            for (Iterator iter = series.iterator(); iter.hasNext();) {
            ...
            }
    Exception in thread "Thread-985" java.util.ConcurrentModificationException
            at
    java.util.LinkedList$ListItr.checkForComodification(LinkedList.java:617)

    Is there a way to lock/synchronize the addToSeries or the iter.hasNext()
    .... what is the good way to do this with cayenne ?

    many thanks,

    Arnaud



    This archive was generated by hypermail 2.0.0 : Mon Apr 24 2006 - 10:57:12 EDT