Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 164653 - [DataBinding] Ensure and document thread safety
Summary: [DataBinding] Ensure and document thread safety
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.3   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.3 M7   Edit
Assignee: Brad Reynolds CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 154132
  Show dependency tree
 
Reported: 2006-11-15 10:47 EST by Brad Reynolds CLA
Modified: 2007-05-02 20:40 EDT (History)
1 user (show)

See Also:


Attachments
doSetValue patch (68.53 KB, patch)
2006-12-02 22:33 EST, Brad Reynolds CLA
no flags Details | Diff
patch (85.84 KB, patch)
2006-12-03 21:35 EST, Brad Reynolds CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brad Reynolds CLA 2006-11-15 10:47:01 EST
Now that we're a multithreaded library we need to ensure that we are thread safe and that thread safety is documented.

A couple of methods that are not thread safe:
* Policy#getLog()
* Policy#setLog(...)
* AbstactObservable#dispose()
Comment 1 Boris Bokowski CLA 2006-11-15 17:27:39 EST
add/remove listener methods should be made thread safe too.
Comment 2 Brad Reynolds CLA 2006-11-19 12:06:57 EST
I started looking at ths and we probably also want to check for the current realm in:
* setValue
* fire*Event

The only issue is that in order to provide this check in setValue we'll need to make it final and provide a template method like in getValue.  This will break all observable value implementations.  I don't mind doing it, just want to make sure you don't have other plans/ideas.
Comment 3 Brad Reynolds CLA 2006-11-30 23:21:00 EST
On the Nov. 30th data binding call we agreed that we need to follow the same pattern for setValue as we did for getValue (make setValue final and provide a doSetValue template method).  We also need to make changes to ObservableSet, ObservableList, etc.
Comment 4 Brad Reynolds CLA 2006-11-30 23:22:04 EST
Target Milestone is 3.3M4
Comment 5 Brad Reynolds CLA 2006-12-02 22:33:06 EST
Created attachment 54950 [details]
doSetValue patch

Changes to AbstractObservableValue and all observables to implement doSetValue.  The only unexpected change was creating doSetApprovedValue(...) in AbstractVetoableValue to ensure that the consumer didn't override doSetValue.
Comment 6 Brad Reynolds CLA 2006-12-03 21:35:40 EST
Created attachment 54965 [details]
patch

Contains the previous changes for doSetValue and the following:

AbstractObservable
==================
public synchronized void addChangeListener(IChangeListener listener)
public synchronized void removeChangeListener(IChangeListener listener) 
public synchronized void addStaleListener(IStaleListener listener)
public synchronized void removeStaleListener(IStaleListener listener)
protected synchronized boolean hasListeners()
public synchronized void dispose() 

added checkRealm() to:
fireChange()
fireStale()

AbstractObservableValue
=======================
public synchronized void addValueChangeListener(IValueChangeListener listener)
public synchronized void removeValueChangeListener(IValueChangeListener listener)
protected synchronized boolean hasListeners()
public synchronized void dispose()

AbstractVetoableValue
=====================
public synchronized void addValueChangingListener(IValueChangingListener listener)
public synchronized void removeValueChangingListener(IValueChangingListener listener)

added checkRealm() to:
fireValueChanging()

Policy
======
public static synchronized void setLog(ILogger logger)
public static synchronized ILogger getLog()
Comment 7 Boris Bokowski CLA 2006-12-04 11:42:42 EST
Patch released >20061204.
Comment 8 Brad Reynolds CLA 2006-12-08 01:14:32 EST
I've got a little more work to do.  I need to apply the same concepts to lists, sets, and trees as well.
Comment 9 Brad Reynolds CLA 2006-12-13 00:04:03 EST
I didn't get all of this in for 3.3M4, pushing to 3.3M5.
Comment 10 Brad Reynolds CLA 2007-01-25 21:28:33 EST
I'm going to have to push the rest of this to M6.  I doubt I'll have time to complete it before M5.  I don't believe that there were any API changes needed.  I just need to go through and checking realms and synchronizing listeners for Sets.
Comment 11 Brad Reynolds CLA 2007-03-22 22:51:57 EDT
Moving to 3.3M7.
Comment 12 Brad Reynolds CLA 2007-04-11 23:26:48 EDT
FIXED > 20070411.
Comment 13 Brad Reynolds CLA 2007-05-02 20:40:45 EDT
VERIFIED in I20070502-1336