How to write a multithreads model with emf?

715 views Asked by At

I am writting a multithreads program with java, so in my emf model that some class need implements the Runnable class, so i wondered how to do this with emf? such as:

public interface MyClass extends Runnable {

rather than:

public interface MyClass extends EObject {

?

2

There are 2 answers

0
Cédric Brun On BEST ANSWER

As a side note EMF Core itself is not thread safe, two options are existing : EMF-CDO which allow concurrent modifications with transactions EMF-Transaction which allow you to control the way changes are being made spliting those into TransactionalCommands, the changes are not really applied concurrently though.

1
Stephen C On

I don't have an up-to-date EMF install to hand, but the EMF book (ed 2) says that you do this by changing the "Model Class Defaults>Root extends Interface" property in your GenModel.

However, I have my doubts that using Runnable will work. Maybe you should define your own interface that extends both Runnable and EObject ?