如何用emf编写多线程模型?
我正在用java编写一个多线程程序,所以在我的emf模型中,某些类需要实现Runnable类,所以我想知道如何用emf来做到这一点? 例如:
public interface MyClass extends Runnable {
而不是:
public interface MyClass extends EObject {
?
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 {
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
顺便说一句,EMF Core 本身不是线程安全的,有两个选项:
EMF-CDO 允许与事务并发修改
EMF-Transaction 允许您控制更改的方式,将这些更改拆分为 TransactionalCommands,但这些更改并不是真正同时应用。
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.
我手边没有最新的 EMF 安装,但 EMF 书(ed 2)说您可以通过更改 GenModel 中的“Model Class Defaults>Root extends Interface”属性来实现此目的。
但是,我怀疑使用 Runnable 是否有效。也许您应该定义自己的接口来扩展 Runnable 和 EObject ?
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 bothRunnable
andEObject
?