ContentDataStore should use concurrent data structures for keeping Entry-s
around
---------------------------------------------------------------------------------
Key: GEOT-2759
URL: http://jira.codehaus.org/browse/GEOT-2759
Project: GeoTools
Issue Type: Bug
Components: data jdbc-ng
Affects Versions: 2.5.8, 2.6-RC1
Reporter: Andrea Aime
Fix For: 2.5.8, 2.6-RC1
The entry map should be kept in a concurrent data structure, the existing
synchornization prevents concurrent writes, but not concurerrnt reads while a
write is happening. Using a concurrent map solves the problem (the synch block
is still a good idea to prevent the double creation of a certain entry).
The patch also removes the useless and continuous grabbing of the logger at
each instance creation:
{code}
Index: src/main/java/org/geotools/data/store/ContentDataStore.java
===================================================================
--- src/main/java/org/geotools/data/store/ContentDataStore.java (revisione
34060)
+++ src/main/java/org/geotools/data/store/ContentDataStore.java (copia locale)
@@ -18,9 +18,9 @@
import java.io.IOException;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Logger;
import org.geotools.data.DataAccess;
@@ -38,6 +38,7 @@
import org.geotools.feature.FeatureTypes;
import org.geotools.feature.NameImpl;
import org.geotools.feature.SchemaException;
+import org.geotools.util.logging.Logging;
import org.opengis.feature.FeatureFactory;
import org.opengis.feature.simple.SimpleFeature;
import org.opengis.feature.simple.SimpleFeatureType;
@@ -103,16 +104,16 @@
protected final static int WRITER_UPDATE = 0x01<<1;
/**
+ * logger
+ */
+ final protected static Logger LOGGER =
Logging.getLogger(ContentDataStore.class.getPackage().getName());
+
+ /**
* name, entry map
*/
final protected Map<Name,ContentEntry> entries;
/**
- * logger
- */
- final protected Logger LOGGER;
-
- /**
* Factory used to create feature types
*/
protected FeatureTypeFactory typeFactory;
@@ -143,10 +144,7 @@
protected LockingManager lockingManager = new InProcessLockingManager();
public ContentDataStore() {
- this.entries = new HashMap<Name,ContentEntry>();
- this.LOGGER = org.geotools.util.logging.Logging.getLogger(
- getClass().getPackage().getName()
- );
+ this.entries = new ConcurrentHashMap<Name,ContentEntry>();
}
{code}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel