Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 314595 - Prevent PluginModelManager from being instantiated
Summary: Prevent PluginModelManager from being instantiated
Status: RESOLVED FIXED
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.6   Edit
Hardware: PC Windows 7
: P2 normal (vote)
Target Milestone: 3.7 M2   Edit
Assignee: Ankur Sharma CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-26 22:31 EDT by Curtis Windatt CLA
Modified: 2010-08-13 15:06 EDT (History)
2 users (show)

See Also:


Attachments
Patch (2.56 KB, patch)
2010-06-07 09:08 EDT, Ankur Sharma CLA
no flags Details | Diff
Additional patch (2.71 KB, patch)
2010-08-13 07:21 EDT, Ankur Sharma CLA
no flags Details | Diff
patch (4.78 KB, patch)
2010-08-13 15:00 EDT, Darin Wright CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Curtis Windatt CLA 2010-05-26 22:31:14 EDT
Bug 313922 was caused by additional PluginModelManagers being instantiated whenever a feature launch occurred.  Each time a manager is instantiated it registers listeners that affect the java build path.

To prevent bugs like this in the future we should prevent PluginModelManager from being instantiated.  We can add a javadoc comment, make the constructor package visible (PDECore being the only place that should instantiate), and/or make the class a singleton (with getInstance() instead of a public constructor).
Comment 1 Ankur Sharma CLA 2010-06-07 09:08:56 EDT
Created attachment 171259 [details]
Patch
Comment 2 Ankur Sharma CLA 2010-06-30 07:02:13 EDT
Fixed in HEAD
Comment 3 Darin Wright CLA 2010-08-03 13:55:44 EDT
Looking at the code, there is some clean up that we should do here.

The #getInstance() method on PluginModelManager should be synchronized to avoid having 2 instances created from different threads in a race condition. As well, since the singleton is cahced in the PluginModelManager class, PDECore should not keep a reference to the singleton either...(i.e. in fModelManager). It should always delegate to the #getInstance() method.

In fact, none of the singleton objects in PDECore are created synch blocks, and this should be investigated (i.e. fModelManager, fTargetProfileManager, fFeatureModelManager...).
Comment 4 Ankur Sharma CLA 2010-08-13 07:21:45 EDT
Created attachment 176544 [details]
Additional patch

Added synchronized and cleaned up PDECore
Comment 5 Darin Wright CLA 2010-08-13 15:00:41 EDT
Created attachment 176579 [details]
patch

Added synchronization on creation of other singletons in PDE Core.
Comment 6 Darin Wright CLA 2010-08-13 15:06:38 EDT
Applied/Fixed.