ANRGenstar / genstar

Generation of Synthetic Populations Library
20 stars 2 forks source link

ConcurrentModificationException are thrown once on a while when parallel access to RasterFile#getPixel(int x, int y) method #12

Closed chapuisk closed 7 years ago

chapuisk commented 7 years ago

There is two reason:

1) AGeoValue are conceptualize as a limited set of values according to an AGeoAttribute (i.e. a band in a raster file). Hence, when we access to a new value we must store it as a possible value of the corresponding attribute.

2) Genstar's Pixel of raster file are not stored in memory, but encapsulate, as it is called, geotools output of raster file

So, when we access concurrently to raster's pixels, it may modify the set of encountered value at the same time. It is the case in the SPLAreaMapperBuilder#buildOutput(...) method that write down spatial interpolation to an output raster

chapuisk commented 7 years ago

Factory that build geographical entity (either pixel or vector style geometry) now is based on a set of attributes and known values which is backed by a ConcurrentHashMap using ConcurrentHashMap.KeySetView() static method to initialise it