Eike,
Oops, I screwed up my "standard example" of "thread safe primitives
don't imply thread safe algorithms built with them." Thanks for
noticing. :-)
Eike Stepper wrote:
Ed,
I suspect youmeant this example:
int index = list.indexOf(x);
list.remove(index);
Cheers
/Eike
----
http://thegordian.blogspot.com
Ed Merks schrieb:
Fran,
It's best to ask about EMF on the EMF newsgroup, which I've added to
the "to" list of the reply. No there are no thread safe collections
in EMF. I suppose we could have things like
Collections.synchronizedXyz but I'm convinced that having them is
probably useless and if anything is actually more likely to cause
problem than to solve problems. Consider for example that code like
this isn't thread safe even if the list itself is thread safe.
int index = list.indexOf(x);
list.remove(x);
The point being that higher level logic built on thread safe data
structures will still not generally be thread safe.
Also consider that modifying a list produces notifications and the
handling of those notifications could invoke arbitrary and long running
logic. Holding a lock during this processing might well lead to
deadlock. In my opinion, the only way to achieve thread safety is at
the application level with a carefully managed threading policy.
The EMF Transaction component might well appropriate for whatever
problem you're trying to solve...
Fran wrote:
Which of the available EMF (EList etc.) collections is
thread safe in the same way as java.util.Vector?
|