Community
Participate
Working Groups
Version: 3.7.0 Build id: I20101208-1300 I noticed that once and a while my IDE uses up 100% of my CPU. I have tracked down the issue to the situation reproducable with the sample code below. Basically I have a job that is waiting for another one to complete and the waiting job blocks the IJobManager.beginRule(). In this case the call to IJobManager.beginRule() runs in a loop consuming lots of CPU cycles. // Sample code class Test { // A simple scheduling rule class PerInstance implements ISchedulingRule { public boolean contains(ISchedulingRule rule) { return rule == this; } public boolean isConflicting(ISchedulingRule rule) { return rule == this; } } public void run() { Job j1= new Job("job1") { protected IStatus run(IProgressMonitor monitor) { try { Thread.sleep(15000); // Blocks the second job for 15 secs } catch (InterruptedException e) {} return Status.OK_STATUS; } }; Job j2= new Job("job2") { protected IStatus run(IProgressMonitor monitor) { return Status.OK_STATUS; } }; ISchedulingRule rule1= new PerInstance(); ISchedulingRule rule2= new PerInstance(); j1.setRule(rule1); j2.setRule(MultiRule.combine(rule1, rule2)); j1.schedule(); // Job runs for 15sec. j2.schedule(); // Job is blocked by j1 for 15 sec. // This call runs in a loop until j2 finishes and consumes the CPU Job.getJobManager().beginRule(rule2, new NullProgressMonitor()); // Clean up Job.getJobManager().endRule(rule2); }
*** This bug has been marked as a duplicate of bug 320329 ***