Interesting point, Jody!

I am using it like the following:
Transaction updateTrans = new 
DefaultTransaction("update");
FeatureWriter<SimpleFeatureType, SimpleFeature> writer =
featureStore.getDataStore()
      .getFeatureWriter(featureStore.getDataStore().getTypeNames()[0],
          new 
FidFilterImpl(changedFeautureId2Feature.keySet()),
updateTrans);
for (; writer.hasNext();) {
    SimpleFeature feature2Update = writer.next();
    // ...
    // ...
    // here I change the feature2Update
    // ...
    // ...
    writer.write();
}
writer.close();
updateTrans.commit();
updateTrans.close();

Thanks,
Sergey

On Sat, 6 Mar 2010 22:20:22 +1100
  Jody Garnett <jody.garn...@gmail.com> wrote:

     Can I ask how you are using transactions?

     A lot of software edits a shapefile "in place"; 
GeoTools tends to write out the whole thing again during 
the commit (into a separate file, and then rename the 
files to swap them; and then remove the original).

     There are seperate read and write locks in the 
shapefile code; so the writing out should wait for all the 
readers to be finished before this occurs.

     Jody

     On 06/03/2010, at 7:32 PM, Michael Bedward wrote:

         Hi Sergey,

         I don't know enough about shapefile locking to 
help, sorry. Hopefully
         someone else here can assist.

         Michael

             Hi Michael,

             Yes this is true, I am writing to the 
shapefile being rendered.

             Why this is a problem? A lot of software do 
this.

             I am just need a interactive renderer with 
editing capabilities. BTW it
             correctly renders/writes everything if I 
confine writer.write() and
             updateTrans.commit() statements in try-catch 
clauses.

             Maybe there is a special mode for geotools 
which imposes less restrictive
             locking on shapefiles?

             Thanks,
             Sergey


------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Geotools-devel mailing list
Geotools-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to