On Fri, Feb 3, 2012 at 9:58 AM, Yang <[email protected]> wrote:
> I have one shapefile , multiple threads are running the following code:
>
>         FileDataStore store = new IndexedShapefileDataStore(tzUrl, false,
> true);  <======
>         ustzFeatureSource = store.getFeatureSource();
>         collection = ustzFeatureSource.getFeatures(query);

>
> so it looks I can have only one ShapefileDataStore obj for one file, that's
> fine, then  I can let the multiple threads share one datastore obj, but then
> the question is, is the ShapefileDataStore obj thread-safe? and also the
> FeatureSource obj returned by the DataStore?

Good questions. The javadocs don't say, but normally DataStore implementations
are thread safe, and so are feature source implementations.
GeoServer hits them with many threads concurrently without issues normally,
but the index gets created as we configure the shapefile as a new layer, at
that point only one user (the administrator) is accessing the store.

Patches to improve thread safety are welcomed

Cheers
Andrea


-- 
-------------------------------------------------------
Ing. Andrea Aime
GeoSolutions S.A.S.
Tech lead

Via Poggio alle Viti 1187
55054  Massarosa (LU)
Italy

phone: +39 0584 962313
fax:      +39 0584 962313
mob:    +39 339 8844549

http://www.geo-solutions.it
http://geo-solutions.blogspot.com/
http://www.youtube.com/user/GeoSolutionsIT
http://www.linkedin.com/in/andreaaime
http://twitter.com/geowolf

-------------------------------------------------------

------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to