It's all about the answers!

Ask a question

Clarification about UIUpdaterJob


Petcharat Viriyakattiyaporn (4113) | asked Sep 27 '08, 11:45 a.m.
Hi,
I read in some post that one solution to execute a long-running op is to use UIUpdaterJob to separate a job to background and UI jobs.

I'm not quite clear what UIUpdaterJob#schedule() does. The Javadoc explains that the schedule() method schedules an update and cancels any running update. What is the 'running update'? Is it the main thread? Or does it mean if there is any other UIUpdaterJob running, the UIUpdaterJob will be canceled and this job will start running, instead? What if I want to make sure that each UIUpdaterJob instance is finished before another one is executed?

I looked at the org.eclipse.core.runtime.Job api, and it says the schedule() method in this API schedules the job in a queue waiting to be run. In this way, it makes sure that all the Jobs are executed. Does schedule() in UIUpdaterJob and Job do the same thing?

Thanks,
Petcharat

One answer



permanent link
Patrick Streule (4.9k21) | answered Sep 28 '08, 5:52 a.m.
JAZZ DEVELOPER
I'm not quite clear what UIUpdaterJob#schedule() does. The Javadoc
explains that the schedule() method schedules an update and cancels
any running update. What is the 'running update'? Is it the main
thread? Or does it mean if there is any other UIUpdaterJob running,
the UIUpdaterJob will be canceled and this job will start running,
instead? What if I want to make sure that each UIUpdaterJob instance
is finished before another one is executed?

I looked at the org.eclipse.core.runtime.Job api, and it says the
schedule() method in this API schedules the job in a queue waiting to
be run. In this way, it makes sure that all the Jobs are executed.
Does schedule() in UIUpdaterJob and Job do the same thing?

The schedule() method cancels a running update of the same UIUpdaterJob
instance if there is one. Consider this pseudo-code:

UIUpdaterJob job= ....

private void selectionChanged(SelectionChangedEvent e) {
job.schedule();
}

If 'job' is already running when schedule() is called, it will be
canceled first.

Other UIUpdateJob instances are not affected. So if you create new
instances of your UIUpdaterJob, each of them will run independently.

HTH,
Patrick,
Jazz Work Item Team

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.