Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] CDOView is expected to be used by one thread ?
[CDO] CDOView is expected to be used by one thread ? [message #424674] Sat, 01 November 2008 18:03 Go to next message
Simon Mc Duff is currently offline Simon Mc DuffFriend
Messages: 596
Registered: July 2009
Senior Member
Eike,

I would like to revisit an assumption in CDO.

CDOVIew is expected to be used by one thread.

I always code it to not be used by only 1 thread.

I think how it is built right now.. this assumptions is really hard as
an end-user.

- End-user access the data from ThreadA
- Notifications are done into a different Thread (threadB). When objects
received notifications, it will likely use that object...At this point
THReadB and ThreadA are using it.
- A query could be running asynchronously.. and be running in another
thread (as a endusers point of view).


I think CDOView should be safe to be used in many thread at the same
time.(like the most major part f the API.. CDOView.getObject()).. etc..

I don't think it require that much effort to do so.. if it is not
already safe to use it in multi-thread environment.

I'm not sure at 100% but I think even the CDOEditor is accessing objects
from many threads at the same time!

What do you think ?

Simon
Re: [CDO] CDOView is expected to be used by one thread ? [message #424679 is a reply to message #424674] Sat, 01 November 2008 19:46 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------090207000509000603040006
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Simon,

I don't know any of the details, but I'd be concerned about the same
kind of issue that makes these two lines of code unsafe even if the list
itself is thread safe:

int index = list.indexOf(o);
list.remove(index);

It's not so easy to make something just be thread safe in the face of
arbitrary access, particularly ones that allow modification, from
multiple threads. Of course I'm likely missing the point entirely. :-P


Simon McDuff wrote:
> Eike,
>
> I would like to revisit an assumption in CDO.
>
> CDOVIew is expected to be used by one thread.
>
> I always code it to not be used by only 1 thread.
>
> I think how it is built right now.. this assumptions is really hard as
> an end-user.
>
> - End-user access the data from ThreadA
> - Notifications are done into a different Thread (threadB). When
> objects received notifications, it will likely use that object...At
> this point THReadB and ThreadA are using it.
> - A query could be running asynchronously.. and be running in another
> thread (as a endusers point of view).
>
>
> I think CDOView should be safe to be used in many thread at the same
> time.(like the most major part f the API.. CDOView.getObject()).. etc..
>
> I don't think it require that much effort to do so.. if it is not
> already safe to use it in multi-thread environment.
>
> I'm not sure at 100% but I think even the CDOEditor is accessing
> objects from many threads at the same time!
>
> What do you think ?
>
> Simon
>

--------------090207000509000603040006
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Simon,<br>
<br>
I don't know any of the details, but I'd be concerned about the same
kind of issue that makes these two lines of code unsafe even if the
list itself is thread safe:<br>
<blockquote>int index = list.indexOf(o);<br>
list.remove(index);<br>
</blockquote>
It's not so easy to make something just be thread safe in the face of
arbitrary access, particularly ones that allow modification, from
multiple threads.&nbsp; Of course I'm likely missing the point entirely. :-P<br>
<br>
<br>
Simon McDuff wrote:
<blockquote cite="mid:gei5go$3h9$1@build.eclipse.org" type="cite">Eike,
<br>
<br>
I would like to revisit an assumption in CDO.
<br>
<br>
CDOVIew is expected to be used by one thread.
<br>
<br>
I always code it to not be used by only 1 thread.
<br>
<br>
I think how it is built right now.. this assumptions is really hard as
an end-user.
<br>
<br>
- End-user access the data from ThreadA
<br>
- Notifications are done into a different Thread (threadB). When
objects received notifications, it will likely use that object...At
this point THReadB and ThreadA are using it.
<br>
- A query could be running asynchronously.. and be running in another
thread (as a endusers point of view).
<br>
<br>
<br>
I think CDOView should be safe to be used in many thread at the same
time.(like the most major part f the API.. CDOView.getObject()).. etc..
<br>
<br>
I don't think it require that much effort to do so.. if it is not
already safe to use it in multi-thread environment.
<br>
<br>
I'm not sure at 100% but I think even the CDOEditor is accessing
objects from many threads at the same time!
<br>
<br>
What do you think ?
<br>
<br>
Simon
<br>
<br>
</blockquote>
</body>
</html>

--------------090207000509000603040006--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: [CDO] CDOView is expected to be used by one thread ? [message #424680 is a reply to message #424679] Sat, 01 November 2008 23:01 Go to previous messageGo to next message
Simon Mc Duff is currently offline Simon Mc DuffFriend
Messages: 596
Registered: July 2009
Senior Member
Ed Merks wrote:
> Simon,
>
> I don't know any of the details, but I'd be concerned about the same
> kind of issue that makes these two lines of code unsafe even if the list
> itself is thread safe:
>
> int index = list.indexOf(o);
> list.remove(index);

I would say that if the end-user is doing what you mentionned... and
don't want to have surprised could:

Lock the object that contains the list.
OR
session.setPassiveUpdateEnabled(false)

Simon




>
> It's not so easy to make something just be thread safe in the face of
> arbitrary access, particularly ones that allow modification, from
> multiple threads. Of course I'm likely missing the point entirely. :-P
>
>
> Simon McDuff wrote:
>> Eike,
>>
>> I would like to revisit an assumption in CDO.
>>
>> CDOVIew is expected to be used by one thread.
>>
>> I always code it to not be used by only 1 thread.
>>
>> I think how it is built right now.. this assumptions is really hard as
>> an end-user.
>>
>> - End-user access the data from ThreadA
>> - Notifications are done into a different Thread (threadB). When
>> objects received notifications, it will likely use that object...At
>> this point THReadB and ThreadA are using it.
>> - A query could be running asynchronously.. and be running in another
>> thread (as a endusers point of view).
>>
>>
>> I think CDOView should be safe to be used in many thread at the same
>> time.(like the most major part f the API.. CDOView.getObject()).. etc..
>>
>> I don't think it require that much effort to do so.. if it is not
>> already safe to use it in multi-thread environment.
>>
>> I'm not sure at 100% but I think even the CDOEditor is accessing
>> objects from many threads at the same time!
>>
>> What do you think ?
>>
>> Simon
>>
Re: [CDO] CDOView is expected to be used by one thread ? [message #424687 is a reply to message #424679] Sun, 02 November 2008 13:09 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Ed,

I also wanted to say something that's generally interesting, and then I
did it. In my *new* blog:
http://thegordian.blogspot.com/2008/11/how-safe-is-thread-sa fe-data-structure_02.html
;-)

Have fun
/Eike


Ed Merks schrieb:
> Simon,
>
> I don't know any of the details, but I'd be concerned about the same
> kind of issue that makes these two lines of code unsafe even if the
> list itself is thread safe:
>
> int index = list.indexOf(o);
> list.remove(index);
>
> It's not so easy to make something just be thread safe in the face of
> arbitrary access, particularly ones that allow modification, from
> multiple threads. Of course I'm likely missing the point entirely. :-P
>
>
> Simon McDuff wrote:
>> Eike,
>>
>> I would like to revisit an assumption in CDO.
>>
>> CDOVIew is expected to be used by one thread.
>>
>> I always code it to not be used by only 1 thread.
>>
>> I think how it is built right now.. this assumptions is really hard
>> as an end-user.
>>
>> - End-user access the data from ThreadA
>> - Notifications are done into a different Thread (threadB). When
>> objects received notifications, it will likely use that object...At
>> this point THReadB and ThreadA are using it.
>> - A query could be running asynchronously.. and be running in another
>> thread (as a endusers point of view).
>>
>>
>> I think CDOView should be safe to be used in many thread at the same
>> time.(like the most major part f the API.. CDOView.getObject()).. etc..
>>
>> I don't think it require that much effort to do so.. if it is not
>> already safe to use it in multi-thread environment.
>>
>> I'm not sure at 100% but I think even the CDOEditor is accessing
>> objects from many threads at the same time!
>>
>> What do you think ?
>>
>> Simon
>>


Re: [CDO] CDOView is expected to be used by one thread ? [message #424689 is a reply to message #424674] Sun, 02 November 2008 13:23 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Simon,

I think each *single* method of the CDOView API (and derived/contained
concepts) is safe to be called in a multi-threaded environment as long
as the same is valid for the used EMF concepts. Do you mean a certain
place where we might have problems?

Cheers
/Eike

----
http://wiki.eclipse.org/CDO
http://wiki.eclipse.org/Net4j




Simon McDuff schrieb:
> Eike,
>
> I would like to revisit an assumption in CDO.
>
> CDOVIew is expected to be used by one thread.
>
> I always code it to not be used by only 1 thread.
>
> I think how it is built right now.. this assumptions is really hard as
> an end-user.
>
> - End-user access the data from ThreadA
> - Notifications are done into a different Thread (threadB). When
> objects received notifications, it will likely use that object...At
> this point THReadB and ThreadA are using it.
> - A query could be running asynchronously.. and be running in another
> thread (as a endusers point of view).
>
>
> I think CDOView should be safe to be used in many thread at the same
> time.(like the most major part f the API.. CDOView.getObject()).. etc..
>
> I don't think it require that much effort to do so.. if it is not
> already safe to use it in multi-thread environment.
>
> I'm not sure at 100% but I think even the CDOEditor is accessing
> objects from many threads at the same time!
>
> What do you think ?
>
> Simon
>


Re: [CDO] CDOView is expected to be used by one thread ? [message #424691 is a reply to message #424689] Sun, 02 November 2008 13:45 Go to previous messageGo to next message
Simon Mc Duff is currently offline Simon Mc DuffFriend
Messages: 596
Registered: July 2009
Senior Member
Not specifically but in many of our discussion we were saying the following:

[01/11/2008 11:48:02 AM] Eike Stepper says: but a view is expected to be
used by exactly 1 thread!


Based on your last comment on the newsgroup.. we do not assume that a
view is used by exactly 1 thread. Right ?


Eike Stepper wrote:
> Simon,
>
> I think each *single* method of the CDOView API (and derived/contained
> concepts) is safe to be called in a multi-threaded environment as long
> as the same is valid for the used EMF concepts. Do you mean a certain
> place where we might have problems?
>
> Cheers
> /Eike
>
> ----
> http://wiki.eclipse.org/CDO
> http://wiki.eclipse.org/Net4j
>
>
>
>
> Simon McDuff schrieb:
>> Eike,
>>
>> I would like to revisit an assumption in CDO.
>>
>> CDOVIew is expected to be used by one thread.
>>
>> I always code it to not be used by only 1 thread.
>>
>> I think how it is built right now.. this assumptions is really hard as
>> an end-user.
>>
>> - End-user access the data from ThreadA
>> - Notifications are done into a different Thread (threadB). When
>> objects received notifications, it will likely use that object...At
>> this point THReadB and ThreadA are using it.
>> - A query could be running asynchronously.. and be running in another
>> thread (as a endusers point of view).
>>
>>
>> I think CDOView should be safe to be used in many thread at the same
>> time.(like the most major part f the API.. CDOView.getObject()).. etc..
>>
>> I don't think it require that much effort to do so.. if it is not
>> already safe to use it in multi-thread environment.
>>
>> I'm not sure at 100% but I think even the CDOEditor is accessing
>> objects from many threads at the same time!
>>
>> What do you think ?
>>
>> Simon
>>
Re: [CDO] CDOView is expected to be used by one thread ? [message #424700 is a reply to message #424691] Mon, 03 November 2008 08:25 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Simon McDuff schrieb:
> Not specifically but in many of our discussion we were saying the
> following:
>
> [01/11/2008 11:48:02 AM] Eike Stepper says: but a view is expected to
> be used by exactly 1 thread!
>
>
> Based on your last comment on the newsgroup.. we do not assume that a
> view is used by exactly 1 thread. Right ?
Personally I still believe that 2 threads modifying an EMF model can
corrupt the model.
Modifying an EMF model involves inverse operations on objects different
from the ones the operation was called on.
And I think that even list operations on a single object are not
automatically protected against concurrent modification.
But this is not related to CDO.

So I'd like to re-word my former assumptions:
We don't expect any ResourceSet be modified by more than one thread,
whether it is managed by a CDOView or not.

A client that never cared about cocurrent model write-access will
certainly not be worse when using CDO managed models.
But I still hesitate to recommend our users to access a CDOView from
multiple threads.
Although the CDOView itself should be safe in this regard.

Cheers
/Eike

----
http://wiki.eclipse.org/CDO
http://wiki.eclipse.org/Net4j



> Eike Stepper wrote:
>> Simon,
>>
>> I think each *single* method of the CDOView API (and
>> derived/contained concepts) is safe to be called in a multi-threaded
>> environment as long as the same is valid for the used EMF concepts.
>> Do you mean a certain place where we might have problems?
>>
>> Cheers
>> /Eike
>>
>> ----
>> http://wiki.eclipse.org/CDO
>> http://wiki.eclipse.org/Net4j
>>
>>
>>
>>
>> Simon McDuff schrieb:
>>> Eike,
>>>
>>> I would like to revisit an assumption in CDO.
>>>
>>> CDOVIew is expected to be used by one thread.
>>>
>>> I always code it to not be used by only 1 thread.
>>>
>>> I think how it is built right now.. this assumptions is really hard
>>> as an end-user.
>>>
>>> - End-user access the data from ThreadA
>>> - Notifications are done into a different Thread (threadB). When
>>> objects received notifications, it will likely use that object...At
>>> this point THReadB and ThreadA are using it.
>>> - A query could be running asynchronously.. and be running in
>>> another thread (as a endusers point of view).
>>>
>>>
>>> I think CDOView should be safe to be used in many thread at the same
>>> time.(like the most major part f the API.. CDOView.getObject()).. etc..
>>>
>>> I don't think it require that much effort to do so.. if it is not
>>> already safe to use it in multi-thread environment.
>>>
>>> I'm not sure at 100% but I think even the CDOEditor is accessing
>>> objects from many threads at the same time!
>>>
>>> What do you think ?
>>>
>>> Simon
>>>


Re: [CDO] CDOView is expected to be used by one thread ? [message #424704 is a reply to message #424700] Mon, 03 November 2008 12:21 Go to previous messageGo to next message
Simon Mc Duff is currently offline Simon Mc DuffFriend
Messages: 596
Registered: July 2009
Senior Member
>>Used<< means read and write, not necessarily only write. By reading
your post it seems that write is the only possible way.

Is it true to say ?
- ResourceSet could be read access by many threads.
- ResourceSet could be write access by many threads but needs to be
synchronized by the end-users !!(for same objects)

Simon


Eike Stepper wrote:
> Simon McDuff schrieb:
>> Not specifically but in many of our discussion we were saying the
>> following:
>>
>> [01/11/2008 11:48:02 AM] Eike Stepper says: but a view is expected to
>> be used by exactly 1 thread!
>>
>>
>> Based on your last comment on the newsgroup.. we do not assume that a
>> view is used by exactly 1 thread. Right ?
> Personally I still believe that 2 threads modifying an EMF model can
> corrupt the model.
> Modifying an EMF model involves inverse operations on objects different
> from the ones the operation was called on.
> And I think that even list operations on a single object are not
> automatically protected against concurrent modification.
> But this is not related to CDO.
>
> So I'd like to re-word my former assumptions:
> We don't expect any ResourceSet be modified by more than one thread,
> whether it is managed by a CDOView or not.
>
> A client that never cared about cocurrent model write-access will
> certainly not be worse when using CDO managed models.
> But I still hesitate to recommend our users to access a CDOView from
> multiple threads.
> Although the CDOView itself should be safe in this regard.
>
> Cheers
> /Eike
>
> ----
> http://wiki.eclipse.org/CDO
> http://wiki.eclipse.org/Net4j
>
>
>
>> Eike Stepper wrote:
>>> Simon,
>>>
>>> I think each *single* method of the CDOView API (and
>>> derived/contained concepts) is safe to be called in a multi-threaded
>>> environment as long as the same is valid for the used EMF concepts.
>>> Do you mean a certain place where we might have problems?
>>>
>>> Cheers
>>> /Eike
>>>
>>> ----
>>> http://wiki.eclipse.org/CDO
>>> http://wiki.eclipse.org/Net4j
>>>
>>>
>>>
>>>
>>> Simon McDuff schrieb:
>>>> Eike,
>>>>
>>>> I would like to revisit an assumption in CDO.
>>>>
>>>> CDOVIew is expected to be used by one thread.
>>>>
>>>> I always code it to not be used by only 1 thread.
>>>>
>>>> I think how it is built right now.. this assumptions is really hard
>>>> as an end-user.
>>>>
>>>> - End-user access the data from ThreadA
>>>> - Notifications are done into a different Thread (threadB). When
>>>> objects received notifications, it will likely use that object...At
>>>> this point THReadB and ThreadA are using it.
>>>> - A query could be running asynchronously.. and be running in
>>>> another thread (as a endusers point of view).
>>>>
>>>>
>>>> I think CDOView should be safe to be used in many thread at the same
>>>> time.(like the most major part f the API.. CDOView.getObject()).. etc..
>>>>
>>>> I don't think it require that much effort to do so.. if it is not
>>>> already safe to use it in multi-thread environment.
>>>>
>>>> I'm not sure at 100% but I think even the CDOEditor is accessing
>>>> objects from many threads at the same time!
>>>>
>>>> What do you think ?
>>>>
>>>> Simon
>>>>
Re: [CDO] CDOView is expected to be used by one thread ? [message #424707 is a reply to message #424704] Mon, 03 November 2008 12:35 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Simon McDuff schrieb:
> >>Used<< means read and write, not necessarily only write. By reading
> your post it seems that write is the only possible way.
No, but when only reading threads are present there's no problem at all.
As soon as only one writing thread is present all threads (readers and
writers) must synchronize on the same mutex locks.
Ideally they would all use the lock of the ResourceSet, since:

1) Sometimes it's hard for a client to predict which objects will be
modified through a single method invocaation.
2) The more locks are around and no lock ordering is happening the more
likely are deadlocks.

>
> Is it true to say ?
> - ResourceSet could be read access by many threads.
As long as no thread writes to it, yes.

> - ResourceSet could be write access by many threads but needs to be
> synchronized by the end-users !!(for same objects)
If I interpet Ed's comments and my own observations right, yes. Ed?

Cheers
/Eike

----
http://wiki.eclipse.org/CDO
http://wiki.eclipse.org/Net4j



>
> Simon
>
>
> Eike Stepper wrote:
>> Simon McDuff schrieb:
>>> Not specifically but in many of our discussion we were saying the
>>> following:
>>>
>>> [01/11/2008 11:48:02 AM] Eike Stepper says: but a view is expected
>>> to be used by exactly 1 thread!
>>>
>>>
>>> Based on your last comment on the newsgroup.. we do not assume that
>>> a view is used by exactly 1 thread. Right ?
>> Personally I still believe that 2 threads modifying an EMF model can
>> corrupt the model.
>> Modifying an EMF model involves inverse operations on objects
>> different from the ones the operation was called on.
>> And I think that even list operations on a single object are not
>> automatically protected against concurrent modification.
>> But this is not related to CDO.
>>
>> So I'd like to re-word my former assumptions:
>> We don't expect any ResourceSet be modified by more than one thread,
>> whether it is managed by a CDOView or not.
>>
>> A client that never cared about cocurrent model write-access will
>> certainly not be worse when using CDO managed models.
>> But I still hesitate to recommend our users to access a CDOView from
>> multiple threads.
>> Although the CDOView itself should be safe in this regard.
>>
>> Cheers
>> /Eike
>>
>> ----
>> http://wiki.eclipse.org/CDO
>> http://wiki.eclipse.org/Net4j
>>
>>
>>
>>> Eike Stepper wrote:
>>>> Simon,
>>>>
>>>> I think each *single* method of the CDOView API (and
>>>> derived/contained concepts) is safe to be called in a
>>>> multi-threaded environment as long as the same is valid for the
>>>> used EMF concepts. Do you mean a certain place where we might have
>>>> problems?
>>>>
>>>> Cheers
>>>> /Eike
>>>>
>>>> ----
>>>> http://wiki.eclipse.org/CDO
>>>> http://wiki.eclipse.org/Net4j
>>>>
>>>>
>>>>
>>>>
>>>> Simon McDuff schrieb:
>>>>> Eike,
>>>>>
>>>>> I would like to revisit an assumption in CDO.
>>>>>
>>>>> CDOVIew is expected to be used by one thread.
>>>>>
>>>>> I always code it to not be used by only 1 thread.
>>>>>
>>>>> I think how it is built right now.. this assumptions is really
>>>>> hard as an end-user.
>>>>>
>>>>> - End-user access the data from ThreadA
>>>>> - Notifications are done into a different Thread (threadB). When
>>>>> objects received notifications, it will likely use that
>>>>> object...At this point THReadB and ThreadA are using it.
>>>>> - A query could be running asynchronously.. and be running in
>>>>> another thread (as a endusers point of view).
>>>>>
>>>>>
>>>>> I think CDOView should be safe to be used in many thread at the
>>>>> same time.(like the most major part f the API..
>>>>> CDOView.getObject()).. etc..
>>>>>
>>>>> I don't think it require that much effort to do so.. if it is not
>>>>> already safe to use it in multi-thread environment.
>>>>>
>>>>> I'm not sure at 100% but I think even the CDOEditor is accessing
>>>>> objects from many threads at the same time!
>>>>>
>>>>> What do you think ?
>>>>>
>>>>> Simon
>>>>>


Re: [CDO] CDOView is expected to be used by one thread ? [message #424721 is a reply to message #424707] Mon, 03 November 2008 13:28 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Guys,

Even reads are problematic in general because a proxy resolve modifies
the state. I.e., just accessing the data can cause a resource to be
demand loaded. And even the lists creation for many-valued features are
null guarded so more than one list could be created. That won't
directly actually do any harm, unless the threads cache this list and
then try to modify it later. Also keep in mind that within a view, one
is often adding adapters to objects, and having two threads
independently trying to add an adapter is also bad news, so even
read-only views are doing things that can get them into trouble.

Find grained locking is very problematic in terms of causing deadlock.
Often I point out to people that even if I put synchronized on every
method, the resulting application still wouldn't be thread safe, but the
odds of it deadlocking would skyrocket.


Eike Stepper wrote:
> Simon McDuff schrieb:
>> >>Used<< means read and write, not necessarily only write. By reading
>> your post it seems that write is the only possible way.
> No, but when only reading threads are present there's no problem at all.
> As soon as only one writing thread is present all threads (readers and
> writers) must synchronize on the same mutex locks.
> Ideally they would all use the lock of the ResourceSet, since:
>
> 1) Sometimes it's hard for a client to predict which objects will be
> modified through a single method invocaation.
> 2) The more locks are around and no lock ordering is happening the
> more likely are deadlocks.
>
>>
>> Is it true to say ?
>> - ResourceSet could be read access by many threads.
> As long as no thread writes to it, yes.
>
>> - ResourceSet could be write access by many threads but needs to be
>> synchronized by the end-users !!(for same objects)
> If I interpet Ed's comments and my own observations right, yes. Ed?
>
> Cheers
> /Eike
>
> ----
> http://wiki.eclipse.org/CDO
> http://wiki.eclipse.org/Net4j
>
>
>
>>
>> Simon
>>
>>
>> Eike Stepper wrote:
>>> Simon McDuff schrieb:
>>>> Not specifically but in many of our discussion we were saying the
>>>> following:
>>>>
>>>> [01/11/2008 11:48:02 AM] Eike Stepper says: but a view is expected
>>>> to be used by exactly 1 thread!
>>>>
>>>>
>>>> Based on your last comment on the newsgroup.. we do not assume that
>>>> a view is used by exactly 1 thread. Right ?
>>> Personally I still believe that 2 threads modifying an EMF model can
>>> corrupt the model.
>>> Modifying an EMF model involves inverse operations on objects
>>> different from the ones the operation was called on.
>>> And I think that even list operations on a single object are not
>>> automatically protected against concurrent modification.
>>> But this is not related to CDO.
>>>
>>> So I'd like to re-word my former assumptions:
>>> We don't expect any ResourceSet be modified by more than one thread,
>>> whether it is managed by a CDOView or not.
>>>
>>> A client that never cared about cocurrent model write-access will
>>> certainly not be worse when using CDO managed models.
>>> But I still hesitate to recommend our users to access a CDOView from
>>> multiple threads.
>>> Although the CDOView itself should be safe in this regard.
>>>
>>> Cheers
>>> /Eike
>>>
>>> ----
>>> http://wiki.eclipse.org/CDO
>>> http://wiki.eclipse.org/Net4j
>>>
>>>
>>>
>>>> Eike Stepper wrote:
>>>>> Simon,
>>>>>
>>>>> I think each *single* method of the CDOView API (and
>>>>> derived/contained concepts) is safe to be called in a
>>>>> multi-threaded environment as long as the same is valid for the
>>>>> used EMF concepts. Do you mean a certain place where we might have
>>>>> problems?
>>>>>
>>>>> Cheers
>>>>> /Eike
>>>>>
>>>>> ----
>>>>> http://wiki.eclipse.org/CDO
>>>>> http://wiki.eclipse.org/Net4j
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Simon McDuff schrieb:
>>>>>> Eike,
>>>>>>
>>>>>> I would like to revisit an assumption in CDO.
>>>>>>
>>>>>> CDOVIew is expected to be used by one thread.
>>>>>>
>>>>>> I always code it to not be used by only 1 thread.
>>>>>>
>>>>>> I think how it is built right now.. this assumptions is really
>>>>>> hard as an end-user.
>>>>>>
>>>>>> - End-user access the data from ThreadA
>>>>>> - Notifications are done into a different Thread (threadB). When
>>>>>> objects received notifications, it will likely use that
>>>>>> object...At this point THReadB and ThreadA are using it.
>>>>>> - A query could be running asynchronously.. and be running in
>>>>>> another thread (as a endusers point of view).
>>>>>>
>>>>>>
>>>>>> I think CDOView should be safe to be used in many thread at the
>>>>>> same time.(like the most major part f the API..
>>>>>> CDOView.getObject()).. etc..
>>>>>>
>>>>>> I don't think it require that much effort to do so.. if it is not
>>>>>> already safe to use it in multi-thread environment.
>>>>>>
>>>>>> I'm not sure at 100% but I think even the CDOEditor is accessing
>>>>>> objects from many threads at the same time!
>>>>>>
>>>>>> What do you think ?
>>>>>>
>>>>>> Simon
>>>>>>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:No .getEEnumLiteral() method in Enumerator interface
Next Topic:Two values stored per EStructuralFeature
Goto Forum:
  


Current Time: Fri Apr 26 04:00:13 GMT 2024

Powered by FUDForum. Page generated in 0.03267 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top