Hi,

I've now protected the code with a ReadWriteLock:
https://github.com/sampov2/geotools/commit/c3b41de9217a6b14d15700f3a2d07de88480c4ce

The String intern() pattern was actually a common pattern used in other
places in WFSDataStore. If you accept my implementation, it would make
sense to use the pattern in the other methods as well.


 Sampo

On Thu, Nov 13, 2014 at 4:02 PM, Jody Garnett <[email protected]>
wrote:

> We tend to use the java concurrency API, for an example a ReadWrite lock
> if that is appropriate.
>
> Jody Garnett
>
> On Mon, Nov 10, 2014 at 11:26 PM, Sampo Savolainen <
> [email protected]> wrote:
>
>> Hi,
>>
>> Last spring I worked on creating Cascaded WFS 2.0.0 Stored Query support
>> into GeoTools and GeoServer. This work has been done for the Finnish
>> Meteorological Institute. I've now resumed my work after GeoServer 2.6 got
>> released and development stabilized (and my schedule freed up), and I'm
>> working on a pull request for GeoTools. I've been discussing the changes
>> with Jody and I and/or we have two questions for all of you regarding our
>> conversation. I've split these two questions into separate emails so the
>> discussion won't get confused.
>>
>> Also, if anyone else wants to check out the pull request, please do.
>> Given enough eyeballs, and so on.
>>
>>
>> In wfs-ng WFSDataStore, I have a Map for caching StoredQueryDescriptions.
>> The key for the map is the id of the stored query in question (as a
>> String). The Map is populated lazily and it's entirely possible that
>> multiple threads might access the same stored query at the same time. I use
>> a ConcurrentHashMap to avoid basic synchronization issues, but this
>> particular code is to safeguard GeoTools from querying the same information
>> from the WFS in multiple threads at the same time.
>>
>>
>> https://github.com/sampov2/geotools/commit/f8a7d7cfe9c3c75e5619d9960a6747a220af1e43#commitcomment-8379257
>>
>> The current strategy is very naive (synchronized(id.intern()) { }) and as
>> Jody correctly points out, other bits of code might be synchronizing on
>> these interned Strings.
>>
>> My question is if there is a preferred and often used locking strategy in
>> GeoTools that fits the bill here?
>>
>>
>>  Thanks,
>>   Sampo
>>
>> --
>> Sampo Savolainen
>> R&D Director, Spatineo Oy
>> [email protected]
>> +358-407555649
>> Linnankoskenkatu 16 A 17, 00250 Helsinki, Finland
>> www.spatineo.com, twitter.com/#!/spatineo
>> www.linkedin.com/company/spatineo-inc
>>
>> This message may contain privileged and/or confidential information. If
>> you
>> have received this e-mail in error or are not the intended recipient, you
>> may not use, copy, disseminate, or distribute it; do not open any
>> attachments, delete it immediately from your system and notify the sender
>> promptly by e-mail that you have done so.
>>
>>
>> ------------------------------------------------------------------------------
>> Comprehensive Server Monitoring with Site24x7.
>> Monitor 10 servers for $9/Month.
>> Get alerted through email, SMS, voice calls or mobile push notifications.
>> Take corrective actions from your mobile device.
>>
>> http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg.clktrk
>> _______________________________________________
>> GeoTools-Devel mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/geotools-devel
>>
>>
>


-- 
Sampo Savolainen
R&D Director, Spatineo Oy
[email protected]
+358-407555649
Linnankoskenkatu 16 A 17, 00250 Helsinki, Finland
www.spatineo.com, twitter.com/#!/spatineo
www.linkedin.com/company/spatineo-inc

This message may contain privileged and/or confidential information. If you
have received this e-mail in error or are not the intended recipient, you
may not use, copy, disseminate, or distribute it; do not open any
attachments, delete it immediately from your system and notify the sender
promptly by e-mail that you have done so.
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
GeoTools-Devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to