I think a ConcurrentModificationException is caused when one thread is
in the process of iterating a collection (e.g. a Vector) and another
thread modifies the collection by adding or removing elements.

I don't know if this is the best but here is my method for updating the
runnableQueue:

public synchronized void runnableQueueInvoke(Runnable runnable, boolean
wait)
{
    try
    {
        if (runnableQueue == null)
        {
            UpdateManager updateManager = svgCanvas.getUpdateManager();
            if (updateManager != null)
            {
                if (updateManager.isRunning())
                {
                    runnableQueue =
updateManager.getUpdateRunnableQueue();
                    if (runnableQueue.getQueueState() !=
                            RunnableQueue.RUNNING)
                        runnableQueue = null;
                }
                updateManager = null;
            }
        }
        if (runnableQueue != null)
        {
            if (runnableQueue.getQueueState() == RunnableQueue.RUNNING)
            {
                if (wait)
                    runnableQueue.invokeAndWait(runnable);
                else
                    runnableQueue.invokeLater(runnable);
            }
            else
                runnableQueue = null;
        }
    }
    catch (Exception ex) {
        System.out.println("runnableQueueInvoke:"+ex);
    }
}

Any comments are welcome.

Stan Dickerson


On Mon, 2004-10-04 at 14:25, Frederik Santens wrote:
> Hi,
> 
>  
> 
> We have a svg application that  updates a svg canvas via its
> updatemanager. The changes are triggered by a poller that polls for
> database changes. This poller runs in a separte thread. Every 2
> seconds, a maximum of 400 svg parts can get updated. However we
> receive the following exception:
> 
>  
> 
>  
> 
> java.util.ConcurrentModificationException
> 
>             at
> java.util.HashMap$HashIterator.nextEntry(HashMap.java:782)
> 
>             at java.util.HashMap$KeyIterator.next(HashMap.java:818)
> 
>             at
> org.apache.batik.gvt.UpdateTracker.getDirtyAreas(UpdateTracker.java:99)
> 
>             at org.apache.batik.bridge.UpdateManager.repaint(Unknown
> Source)
> 
>             at
> org.apache.batik.bridge.UpdateManager$UpdateManagerRunHander.runnableInvoked(Unknown 
> Source)
> 
>             at
> org.apache.batik.util.RunnableQueue.runnableInvoked(RunnableQueue.java:473)
> 
>             at
> org.apache.batik.util.RunnableQueue.run(RunnableQueue.java:217)
> 
>             at java.lang.Thread.run(Thread.java:534)
> 
>  
> 
> Any Idea’s?
> 
>  
> 
> Thx,
> 
> Frederik
> 
> 
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.769 / Virus Database: 516 - Release Date: 9/24/2004
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to