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

Bug 388882

Summary: Config Admin does not call updated() in some cases
Product: [ECD] Orion Reporter: Mark Macdonald <mamacdon>
Component: ClientAssignee: Mark Macdonald <mamacdon>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: simon_kaegi
Version: 1.0   
Target Milestone: 1.0 M2   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Bug Depends on: 389194    
Bug Blocks:    

Description Mark Macdonald CLA 2012-09-05 16:35:11 EDT
Currently the bootstrap process (simplified) works like this:
1. Init serviceRegistry
2. Init preferences
3. Init PluginRegistry
4. Init Config Admin

Some Managed Services may be registered (and thus their 'serviceAdded' event dispatched) in Step 3, before the Config Admin is listening to the serviceRegistry.

When Config Admin starts up, it attaches 'serviceAdded' listeners which will call updated(). But this misses out on any Managed Services registered in Step 3.

It needs to listen to plugin loading events and inject updated() calls to any ManagedServices provided in the plugin.
Comment 1 Mark Macdonald CLA 2012-09-07 20:04:46 EDT
I think this requires additional support from the PluginRegistry. When a plugin is entering the LOADED state, and the plugin provides a Managed Service, the Config Admin has to (asynchronously) obtain the configuration data, and queue up a call to deliver it via managedService.updated().

Right now this does not work because the Plugin loads, and allows other service methods to be called, before Config Admin has finished loading the configuration.

This could be done by having PluginRegistry check for a Deferred returned by dispatchEvent(), and wait for it to call back before the Plugin's _deferredLoad resolves.
Comment 2 Mark Macdonald CLA 2012-09-11 15:17:08 EDT
(In reply to comment #1)
> I think this requires additional support from the PluginRegistry. When a
> plugin is entering the LOADED state, and the plugin provides a Managed
> Service, the Config Admin has to (asynchronously) obtain the configuration
> data, and queue up a call to deliver it via managedService.updated().
> 
> This could be done by having PluginRegistry check for a Deferred returned by
> dispatchEvent(), and wait for it to call back before the Plugin's
> _deferredLoad resolves.

The dispatchEvent-Deferred support is no longer present (see bug 385657, bug 389194). As part of the work done in 389194, obtaining configuration data for a PID is no longer an async operation, so the call to managedService.updated() can be queued right away. This fixes the problem

1. http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=c118603aeb77ebcfb7904c2e69f52d1f50ea8a50 (main part)
2. http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=78d8b71ebb69343b9b21ecf03c1c93086ae39a8e (minor omission)