According to my experience, OCLSettingDelegate is not thread safe. I need to calculate the values of attributes of all classes for 1000 models. If i do it in single thread then it takes a lot of time (low performance). If i use multi threading then OCLSettingDelegate is not thread safe. I want to extend OCLSettingDelegate in order to try to make it thread safe. Can you guide me in this regard. I am trying to follow http://wiki.eclipse.org/EMF/New_and_Noteworthy/Helios#Defining_a_Setting_Delegate
The second part of question is "will OCLSettingDelegate be thread safe in upcomming version"?
If you're sufficiently motivated to try to fix it for yourself, we would
be grateful if you provide a patch so that it is fixed for everyone.
To do this you need to check out the org.eclipse.ocl.ecore plugin from
GIT and enhance the classes in the delegate package with appropriate
synchronize declarations. You may also need to check out the inherited
EMF classes (but I hope those are ok).
Regards
Ed Willink
On 11/08/2011 09:12, ModelGeek wrote:
> Hi,
>
> According to my experience, OCLSettingDelegate is not thread safe. I
> need to calculate the values of attributes of all classes for 1000
> models. If i do it in single thread then it takes a lot of time (low
> performance). If i use multi threading then OCLSettingDelegate is not
> thread safe. I want to extend OCLSettingDelegate in order to try to
> make it thread safe. Can you guide me in this regard. I am trying to
> follow
> http://wiki.eclipse.org/EMF/New_and_Noteworthy/Helios#Defining_a_Setting_Delegate
>
> The second part of question is "will OCLSettingDelegate be thread safe
> in upcomming version"?
The N&N was written before OCL delegates were actually implemented. The
real OCL delegates are provided by Eclipse OCL so you have
no need to implement them, but may want to revise them to make them
thread safe.
The actual delegates are nominally stateless, but they have lazily
initialized caches. Placing synchronized around the cache initializations
and the 'pointers' to the delegates could cure the thread safety.
If you are asking about EMF delegates in general, you should perhaps ask
on the EMF newsgroup.