Class AutosaveTask

  • All Implemented Interfaces:
    java.lang.Runnable, DataSetListenerAdapter.Listener, NoteData.NoteDataUpdateListener, LayerManager.LayerChangeListener

    public class AutosaveTask
    extends java.util.TimerTask
    implements LayerManager.LayerChangeListener, DataSetListenerAdapter.Listener, NoteData.NoteDataUpdateListener
    Saves data and note layers periodically so they can be recovered in case of a crash. There are 2 directories - autosave dir: copies of the currently open data layers are saved here every PROP_INTERVAL seconds. When a data layer is closed normally, the corresponding files are removed. If this dir is non-empty on start, JOSM assumes that it crashed last time. - deleted layers dir: "secondary archive" - when autosaved layers are restored they are copied to this directory. We cannot keep them in the autosave folder, but just deleting it would be dangerous: Maybe a feature inside the file caused JOSM to crash. If the data is valuable, the user can still try to open with another versions of JOSM or fix the problem manually. The deleted layers dir keeps at most PROP_DELETED_LAYERS files.
    Since:
    3378 (creation), 10386 (new LayerChangeListener interface)