From: Andrea A. <and...@ge...> - 2013-02-26 19:46:11
|
On Mon, Feb 25, 2013 at 2:48 PM, Robin Pradel <rp...@iv...> wrote: > > So I modified the code in this way:**** > > ** ** > > /****** > > * Synchronizer for access on {@link #classToSqlTypeMappings}**** > > */**** > > *private* *final* Object classToSqlTypeMappingsLock = *new* Object();* > *** > > //...**** > > *public* Map<Class<?>, Integer> getClassToSqlTypeMappings() {**** > > Map<Class<?>, Integer> mapping = classToSqlTypeMappings;**** > > *if* (mapping == *null*) {**** > > *synchronized* (classToSqlTypeMappingsLock) {**** > > mapping = classToSqlTypeMappings;**** > > *if*(mapping == *null*){**** > > classToSqlTypeMappings = *new*HashMap<Class<?>, Integer>(); > **** > > dialect.registerClassToSqlMappings( > classToSqlTypeMappings);**** > > }**** > > }**** > > }**** > > *return* classToSqlTypeMappings;**** > > }**** > > ** ** > > The same lazy initialization is done on other members of JDBCDataStore, so > I would suggest a modification for all these lines of code. > Hum, that's double checked locking, in order to make it work I believe you'll also have to mark classToSqlTypeMappings as volatile > **** > > ** ** > > Does anyone had this problem in the past, too? > You're the first to report it as far as I know. Most applications cache the stores somewhere for performance reasons, that's probably why this has not been reported so far. > **** > > ** ** > > Is anybody already working on this issue? If not, I would create a ticket > in jira and create a patch. > Please do, I believe nobody is working on this Cheers Andrea -- == Our support, Your Success! Visit http://opensdi.geo-solutions.it for more information. == Ing. Andrea Aime @geowolf Technical Lead GeoSolutions S.A.S. Via Poggio alle Viti 1187 55054 Massarosa (LU) Italy phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549 http://www.geo-solutions.it http://twitter.com/geosolutions_it ------------------------------------------------------- |