Hi eclipse community,
I've noticed a strage behavior using the UIJob on Eclipse 4.2 with RAP 1.5. There are multiple jobs containing the same SchedulingRule marking the jobs as conflicting, therefore only one job is executed at the same time. After a few jobs are executed the execution stops even though there are waiting jobs left. I've enabled tracing and added a JobListener to the JobManager logging the scheduling process. The log looks like the following:
26467 [UIThread [a9g3c9umwz091lv1fxs3xodk6]] DEBUG MapView - done propertyChange(9)
17:58:06.338-[Thread[Worker-1,5,main]]Starting job: propertyChange(10)
26468 [Worker-1] DEBUG MapView - aboutToRun propertyChange(10)
26468 [Worker-1] DEBUG MapView - running propertyChange(10)
17:58:06.339-[Thread[Worker-0,5,main]]worker sleeping for: 60000ms
17:58:06.339-[Thread[Worker-1,5,main]]worker sleeping for: 60000ms
The job with id 9 finished successfully. The next job with id 10 is started, but no code is executed (There is no debug message in the log). The code scheduling the jobs looks like the following:
@Override
public void propertyChange(final PropertyChangeEvent evt) {
log.debug("queue propertyChange " + evt.getPropertyName());
scheduleJob(new UIJob("propertyChange") {
@Override
public IStatus runInUIThread(IProgressMonitor monitor) {
log.debug("propertyChange " + evt.getPropertyName());
checkWidget();
//do some work here...
return Status.OK_STATUS;
}
@Override
public boolean shouldRun() {
return MapView.this.isInitialized();
}
@Override
public boolean belongsTo(Object family) {
return MapView.this.equals(family);
}
});
}
protected void scheduleJob(Job job) {
job.setRule(new MapViewSchedulingRule());
job.schedule();
}
private class MapViewSchedulingRule implements ISchedulingRule {
@Override
public boolean contains(ISchedulingRule rule) {
return rule instanceof MapViewSchedulingRule;
}
@Override
public boolean isConflicting(ISchedulingRule rule) {
return rule instanceof MapViewSchedulingRule;
}
}
Has anybody an idea what's wrong or is it a bug in the JobManager?
Many thanks in advance!
[Updated on: Wed, 12 September 2012 07:35]
Report message to a moderator