Jobs and ISchedulingRule [message #1773561] |
Fri, 29 September 2017 11:52 |
Peter Mising name Messages: 95 Registered: July 2009 |
Member |
|
|
Hello,
I have a problem with a Job ISchedulingRule and after reading the Docs multiple times and debugging around I am still not sure what is wrong.
The purpose is the ISchedulingRule should work like a Mutex. I have a Editor that triggers CodeGen operations as eclipse jobs. These jobs should be worked one after another and trigger subjobs like some JDT stuff which uses the WorkspaceRoot as rule. Hence the contains stuff.
My rule looks like this
public class CodeGenMutex implements ISchedulingRule {
public boolean isConflicting(ISchedulingRule rule) {
return contains(rule);
}
public boolean contains(ISchedulingRule rule) {
if (rule instanceof IResource) {
return true;
}
if (rule instanceof MultiRule) {
for (ISchedulingRule subRule : ((MultiRule) rule).getChildren()) {
if (!(subRule instanceof IResource)) {
return rule == this;
}
}
return true;
}
return rule == this;
}
}
So this works as intended but when some jobs are queued very fast after each other the worker will be set to null and the job never finishes.
I assume the ISchedulingRule is not 100% right.
|
|
|
Powered by
FUDForum. Page generated in 0.02781 seconds