Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[udig-dev] ConcurrentModificationException on MemoryDataStore Layer

Hi folks,

Sorry for cross-posting, I'm unsure which forum is the right choise to address this 

I'm wondering about the current behavior adding features programatically to a layer. The layer has a MemoryGeoResourceImpl internally which uses MemoryDataStore (geotools 11.2 & uDig 2.0.0-SNAPSHOT).

I expected to get features stored to DataStore while uDig is (still) rendering features already added. But the during rendering ConcurrentModificatinExtepion's are thrown while writing new features or modifying exiting.


!ENTRY org.locationtech.udig.project 2 0 2015-09-07 16:06:32.517
!MESSAGE class java.util.ConcurrentModificationException occured during rendering: null
!STACK 0
org.locationtech.udig.project.render.RenderException: class java.util.ConcurrentModificationException occured during rendering: null
    at org.locationtech.udig.render.internal.feature.basic.BasicFeatureRenderer.render(BasicFeatureRenderer.java:489)
    at org.locationtech.udig.render.internal.feature.basic.BasicFeatureRenderer.render(BasicFeatureRenderer.java:320)
    at org.locationtech.udig.project.internal.render.impl.RenderJob.startRendering(RenderJob.java:117)
    at org.locationtech.udig.project.internal.render.impl.RenderJob.run(RenderJob.java:222)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: java.util.ConcurrentModificationException
    at java.util.LinkedHashMap$LinkedHashIterator.nextEntry(Unknown Source)
    at java.util.LinkedHashMap$ValueIterator.next(Unknown Source)
    at org.geotools.data.memory.MemoryDataStore.getBounds(MemoryDataStore.java:609)
    at org.geotools.data.AbstractFeatureSource.getBounds(AbstractFeatureSource.java:318)
    at org.geotools.data.AbstractFeatureSource.getBounds(AbstractFeatureSource.java:286)
    at org.locationtech.udig.catalog.memory.internal.MemoryGeoResourceImpl$ScratchResourceInfo.getBounds(MemoryGeoResourceImpl.java:167)
    at org.locationtech.udig.project.internal.impl.GeoResourceInfoInterceptor$Wrapper.getBounds(GeoResourceInfoInterceptor.java:63)
    at org.locationtech.udig.project.internal.impl.LayerImpl.obtainBoundsFromResources(LayerImpl.java:2173)
    at org.locationtech.udig.project.internal.impl.LayerImpl.getBounds(LayerImpl.java:2144)
    at org.locationtech.udig.render.internal.feature.basic.BasicFeatureRenderer.validateBounds(BasicFeatureRenderer.java:567)
    at org.locationtech.udig.render.internal.feature.basic.BasicFeatureRenderer.render(BasicFeatureRenderer.java:363)
    ... 4 more

From a "user" perspective its quite hard to synchchronize access to the datastore while there are different extensions accessing the layer (getBounds, Iterator for Renderer, etc.) and its resources from uDig. I remember a discussion a few years ago about the same problem but cannot find the thread anymore.

Q: What's the best aproach to write features to MemoryDataStore while other having read-access in between? Would it be a good approach using a ConcurrentHashMap internally or using a different DataStore (e.g. h2)?

Thanks in advance

-- Frank

Back to the top