Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 300124

Summary: eventConsumerJob in org.eclipse.epp.usagedata.internal.gathering.services.UsageDataService is never finished
Product: [Technology] EPP Reporter: Snjezana Peco <snjezana.peco>
Component: Usage Data CollectorAssignee: Wayne Beaton <wayne.beaton>
Status: RESOLVED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: manderse, mknauer
Version: unspecified   
Target Milestone: 1.3.0   
Hardware: All   
OS: All   
Whiteboard:

Description Snjezana Peco CLA 2010-01-19 18:38:12 EST
Build Identifier: 20090920-1017

The UserDataService class creates eventConsumerJob that, by default, is running while running Eclipse.
JBT PDE tests have to wait until all Eclipse jobs are finished (Eclipse builder, validators ...). The following method is used:

public static void waitForIdle(long delay) {
	long start = System.currentTimeMillis();
	
	while (!Job.getJobManager().isIdle()) {
		delay(delay);
		if ( (System.currentTimeMillis()-start) > MAX_IDLE ) 
			throw new RuntimeException("A long running task detected"); //$NON-NLS-1$
	}
}

Since eventConsumerJob is never finished, this method throws RuntimeException after MAX_IDLE seconds.
It is not possible to stop monitoring without introducing a dependency to the org.eclipse.epp.usagedata.gathering plugin.

I see two solutions to solve the problem :

- creating eventConsumerJob so that it is started and finished periodically 
- the UsageDataCaptureActivator.start method would check for a system property (org.eclipse.epp.usagedata.gathering.disabled, for instance); if the property is true, the monitoring wouldn't be started. The tests could be started with the VM args -Dorg.eclipse.epp.usagedata.gathering.disabled=true
This solution is easier to implement.

A similar problem was existing in mylyn (https://bugs.eclipse.org/bugs/show_bug.cgi?id=198241)

Reproducible: Always

Steps to Reproduce:
Job.getJobManager().isIdle() always returns false if org.eclipse.epp.usagedata.gathering is started.
Comment 1 Wayne Beaton CLA 2010-01-20 15:54:03 EST
Can you just exclude the UDC bundles from your test configuration? This seems like just as reasonable a solution as setting a system property... Or have I missed something?
Comment 2 Wayne Beaton CLA 2010-02-18 11:47:23 EST
I am assuming that my suggestion to not include the UDC bundles provided the answer and am closing this as WONTFIX. Reopen if I've made an invalid assumption.