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

Bug 499354

Summary: ServiceLocator is not thread-safe (yet, it's accessed from threads, which could lead to inconsistencies)
Product: [Eclipse Project] Platform Reporter: Fabio Zadrozny <fabiofz>
Component: IDEAssignee: Platform-UI-Inbox <Platform-UI-Inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3    
Version: 4.6   
Target Milestone: ---   
Hardware: PC   
OS: Windows NT   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=459833
Whiteboard: stalebug

Description Fabio Zadrozny CLA 2016-08-08 07:21:32 EDT
In https://bugs.eclipse.org/bugs/show_bug.cgi?id=459833, a change was done so that the ServiceLocator doesn't raise ConcurrentModificationException (just using the ConcurrentHashMap fixes that class of issues), but the ConcurrentHashMap is also no consistent in locking (it just bypasses things by assigning to volatile fields, so, it's possible that a service is registered in a thread and it doesn't appear in the other). 

Also, there are some other issues such as: let's say you have 2 concurrent calls to getService().

getService() -> service = null -> creates new service -> stops -> other call makes the same -> service = null -> creates new service -> registers -> stops -> previous proceeds and overrides.

So, this is a request to make it explicit whether the ServiceLocator should actually be thread-safe (and if it is, to fix the implementation).
Comment 1 Eclipse Genie CLA 2020-07-22 05:24:03 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.