Project: Eclipse_Platform_UI
Bug 138695 [Jobs] UI jobs with "serial" scheduling rule creates many threads
Reported: 2006-04-26 14:02:39 | Status: resolved fixed

N20060426-0010 The debugger attempts to minimize thread creation by serializing jobs via scheduling rules, for jobs run within a viewer, etc. It seems that UI jobs with the scheduling rule cause many threads to be created, whereas non-UI jobs with the same rule do not. Example code will be attached - sample plug-in with a view and actions. * "Action 1" in the context menu of the "Sample view" schedules 400 UI jobs with the scheduling rule, and eventually creates 100's of threads * "Action 2" creates 400 non-ui jobs with the same/similar rule, but only ends up creating about 20 worker threads The "serial" rule looks like this: public class SerialPerObjectRule implements ISchedulingRule { private Object fObject = null; public SerialPerObjectRule(Object lock) { fObject = lock; } /* (non-Javadoc) * @see org.eclipse.core.runtime.jobs.ISchedulingRule#contains(org.eclipse.core.runtime.jobs.ISchedulingRule) */ public boolean contains(ISchedulingRule rule) { return rule == this; } /* (non-Javadoc) * @see org.eclipse.core.runtime.jobs.ISchedulingRule#isConflicting(org.eclipse.core.runtime.jobs.ISchedulingRule) */ public boolean isConflicting(ISchedulingRule rule) { if (rule instanceof SerialPerObjectRule) { SerialPerObjectRule vup = (SerialPerObjectRule) rule; return fObject == vup.fObject; } return false; } }

Files changed in fix:
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/concurrency/ConcurrencyTestSuite.java tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/concurrency/TestBug138695.java