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

Bug 325663

Summary: [localdiscovery] File-based discovery bundle tracker tracks RESOLVE bundles
Product: [RT] ECF Reporter: Neil Bartlett <njbartlett>
Component: ecf.remoteservicesAssignee: Scott Lewis <slewis>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: bugs.eclipse.org, slewis
Version: 3.3.0   
Target Milestone: 3.4.0   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
mylyn/context/zip none

Description Neil Bartlett CLA 2010-09-17 18:51:08 EDT
A BundleTracker is used by the file-based discovery bundle org.eclispe.ecf.osgi.services.discovery.local to track bundles that publish a service description using the Remote-Service header. This BundleTracker incorrectly tracks both RESOLVED and ACTIVE bundles.

It does not make sense to track RESOLVED bundles, since then a bundle's contributions cannot be disabled by deactivating it.

The Remote Services Admin specification states that only ACTIVE and STARTING (in the case of lazy activation) bundles should be used.

See method init() of FileBasedDiscoveryImpl.java.
Comment 1 Scott Lewis CLA 2010-09-17 22:08:06 EDT
Fix released to HEAD.

Fix was to replace previously used state mask (36 == RESOLVED | ACTIVE), with:

	bt = new BundleTracker(context, Bundle.ACTIVE | Bundle.STARTING, new BundleTrackerImpl(this));

Thanks Neil for the report.  Resolving as fixed.
Comment 2 Markus Kuppe CLA 2010-09-30 10:49:00 EDT
This fix breaks all three unit tests. https://build.ecf-project.org/hudson/job/C-HEAD-discovery.local.feature/12/testReport/
Comment 3 Markus Kuppe CLA 2010-09-30 10:58:55 EDT
(In reply to comment #2)
> This fix breaks all three unit tests.
> https://build.ecf-project.org/hudson/job/C-HEAD-discovery.local.feature/12/testReport/

The problem appears to be, that now the BundleTracker sends multiple events for the same bundle contributions in the STARTING as well as the ACTIVE state.
Comment 4 Markus Kuppe CLA 2010-09-30 11:21:39 EDT
Removing lazystart from both "...poststarted" test bundles fixes the unit tests. This is a correct fix as those tests are supposed to test cases where bundles are activated explicitly. They are not meant to test lazy activation. ATM we simply don't test lazy activation.
Comment 5 Markus Kuppe CLA 2010-09-30 11:21:41 EDT
Created attachment 179969 [details]
mylyn/context/zip