How to log workspace changes and recover from crashes [message #1708226] |
Mon, 14 September 2015 18:31 |
Johannes Dorn Messages: 61 Registered: June 2013 |
Member |
|
|
My scenario is this.
In my plugin i have an IResourceChangeListener that notifies me if certain files have changed in the workspace. I then do some potentially long running work on each of them in a background job that produces information persisted on disk.
I have a couple of requirements for this when faced with the background job not being able to finish
1. If the workspace changes before my plugin is loaded, i want to be notified about these changes.
2. If the user shuts down Eclipse while the job is still running, the next time Eclipse starts, all outstanding work should be done
3. If Eclipse crashes while the job is still running, the next time Eclipse starts, all outstanding work should be done
4. In scenarios 2&3, little or no work that has already been done should be repeated.
5. However i do this, shouldn't affect performance too much.
I can solve 1,2,3 and 5 by having my resource change listener also being an ISaveParticipant. That way i am notified of all changes between now and the last time i called context.needDelta().
Unfortunately, this doesn't work as well as i had expected.
The problem is that, ISaveParticipant.saving() is rarely called. A FULL_SAVE is only performed on a regular Eclipse shutdown, while i have only seen a SNAPSHOT when creating a new project.
In the event of an Eclipse crash, i might not be able to call context.needDelta() for an entire session. This means that the next start might get deltas for more than one session, forcing me to repeat a lot of work that has already been completed.
I'm also (perhaps unjustified) afraid i may not be notified about all changes, especially if Eclipse crashes in multiple sessions.
My questions are these:
First, aren't save participants designed to handle this kind of situation? It appears to me that they would only work for this kind of scenario, if saving() was called a lot more frequently.
Second, does anyone have a recommended way of handling my situation?
|
|
|
Powered by
FUDForum. Page generated in 0.02589 seconds