Bug 219433 - Sleep and awake events not sent by JobManager
Summary: Sleep and awake events not sent by JobManager
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Runtime (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows Vista
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: John Arthorne CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 209744 167294
  Show dependency tree
 
Reported: 2008-02-19 09:15 EST by Tod Creasey CLA
Modified: 2019-09-17 02:32 EDT (History)
5 users (show)

See Also:


Attachments
Example (7.48 KB, application/octet-stream)
2008-02-19 09:16 EST, Tod Creasey CLA
no flags Details
Patch (1.06 KB, patch)
2008-03-18 14:42 EDT, Tod Creasey CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tod Creasey CLA 2008-02-19 09:15:10 EST
When a job sleeps due to a reschedule after it is done no event is sent to IJobChangeListeners to inform of the change. Likewise when it wakes up.

As a result the ProgressManager is not removing sleeping jobs or updating them when they wake up again.
Comment 1 Tod Creasey CLA 2008-02-19 09:16:59 EST
Created attachment 90064 [details]
Example

This example adds a command which shows all of the events sent for a test job. To replicate this issue load org.eclipse.ui.examples.jobs and start a job that reschedules itself 3 seconds later. You will not get the sleep or awake events.
Comment 2 Tod Creasey CLA 2008-03-18 14:42:28 EDT
Created attachment 92830 [details]
Patch

Here is a patch to solve the sleep case. Note that fix for Bug 209744 does not require this in the end - I can solve it with the current behaviour
Comment 3 Tod Creasey CLA 2008-03-18 14:48:54 EDT
Sorry it is Bug 167294 that is not affected
Comment 4 Tod Creasey CLA 2008-03-19 09:47:38 EDT
Please note that there appears to be a deadlock in my patch presumably because I am calling the sleep event inside of the job lock.
Comment 5 Eclipse Webmaster CLA 2019-09-06 16:07:34 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.
Comment 6 Vasili Gulevich CLA 2019-09-17 02:32:39 EDT
"awake" notification is only emitted when Job.wakeUp() method is called and job is in a certain state (usually sleeping).
"sleeping" notification is only called when Job.sleep() method is called and job is in a certain state (sleeping or waiting).

Both are very special cases and rarely used (for example, sleep() is very similar to cancel() in behaviour, and cancel() should be used in most cases, wakeUp() is similar to schedule(), and schedule() should be used in most cases).


It would be nice to have that clarified in Javadoc of org.eclipse.core.runtime.jobs.IJobChangeListener

Even better would be to deprecate both Job.sleep() and Job.wakeUp(), or document when they should be used in Javadoc.