Changeset 3276 in osm
- Timestamp:
- 2007-06-20T14:23:23+02:00 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/surveyor/src/at/dallermassl/josm/plugin/surveyor/AutoSaveGpsLayerTimerTask.java
r2974 r3276 58 58 @Override 59 59 public void run() { 60 System.out.println("AutoSaving data to file " + file.getAbsolutePath());61 60 62 try { 61 try { 63 62 XmlWriter.OsmWriterInterface writer = getXmlWriter(); 64 63 if(writer != null) { 64 // write to temporary file, on success, rename tmp file to target file: 65 File tmpFile = new File(file.getAbsoluteFile()+".tmp"); 66 System.out.println("AutoSaving data to file " + file.getAbsolutePath()); 65 67 // synchronize on layer to prevent concurrent adding of data to the layer 66 68 // quite a hack, but no other object to sync available :-( 67 69 // @see LiveGpsLayer 68 70 synchronized(LiveGpsLock.class) { 69 XmlWriter.output(new FileOutputStream(file), writer); 70 } 71 XmlWriter.output(new FileOutputStream(tmpFile), writer); 72 } 73 tmpFile.renameTo(file); 71 74 } 72 75 } catch (IOException x) {
Note:
See TracChangeset
for help on using the changeset viewer.