After digging a bit further, i reformulated my problem (and a possible solution) here:
http://jira.codehaus.org/browse/GEOT-4388
The main issue is that ContentFeatureSource itself is evidently not thread-safe (and not claiming to be), but could perhaps be with some modification ?
On 7/02/2013 14:48, Jan De Moerloose wrote:
Hi,

i am trying to make use of the following JDBCDatastore method in a Spring environment (Geomajas):||
||||||
publicTransaction  
<http://docs.geotools.org/stable/javadocs/org/geotools/data/Transaction.html>  
*buildTransaction*(Connection  
<http://java.sun.com/j2se/1.5/docs/api/java/sql/Connection.html?is-external=true>  cx)
||||I am using @Transactional annotations for transaction demarcation and letting the Spring DataSourceTransactionManager handle the transactions. I am calling setTransaction() with the result of the buildTransaction() method before querying the datastore. This seems to work well for some time, but under high load i see the following error pop up:

Caused by: java.lang.IllegalArgumentException: Transaction already has an entry for key:110m_populated_places_simple. Please check for existing State before creating your own. at org.geotools.data.DefaultTransaction.putState(DefaultTransaction.java:98) ~[gt-main-2.7.5.jar:na] at org.geotools.data.store.ContentState.setTransaction(ContentState.java:192) ~[gt-data-2.7.5.jar:na] at org.geotools.data.store.ContentEntry.getState(ContentEntry.java:133) ~[gt-data-2.7.5.jar:na] at org.geotools.data.store.ContentFeatureSource.getAbsoluteSchema(ContentFeatureSource.java:310) ~[gt-data-2.7.5.jar:na] at org.geotools.data.store.ContentFeatureSource.getSchema(ContentFeatureSource.java:287) ~[gt-data-2.7.5.jar:na] at org.geotools.data.store.ContentFeatureCollection.<init>(ContentFeatureCollection.java:121) ~[gt-data-2.7.5.jar:na]

After investigating a bit myself, i came to the conclusion that i don't understand the nature of the Geotools Transaction object. Transaction management in J2EE is typically done with threadlocals, but i don't see any thread-scoped objects being involved in the Geotools transaction. I had a look at the Geoserver code but it apparently does not use the buildTransaction() method at all ? Could someone show me a working example of this + explain the threading issue ?


------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb


_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to