英文:
How can I show, that a method is synchronized in class diagram (UML)?
问题
我已在Java中创建了一个带有public static synchronized
方法的类。
我如何在类图中显示该公共方法(+)是同步的?
编辑:
我想在类图中显示这一点,这很重要!不需要活动图,只需要类图…
英文:
I have created a class in java with a public static synchronized
method.
How can I show that the public method (+) is synchronized in a class diagram?
Edit:
I want to show this in the class diagram, that is important! No need for activity diagram, only CLASS diagram...
答案1
得分: 1
UML默认情况下无法处理同步,但是你可以使用构造型,最好的描述在这篇《使用UML可视化Java线程的同步》论文中有例子。
你可能无法在类图中实现这一点,但是你可以在序列图中实现。
英文:
UML cannot handle synchronized by default, however, you can use stereotypes, this best described in this Visualizing the synchronization of Java-threads with UML paper with examples.
You may not be able to do this with class diagrams, but, you can do it with sequence diagrams.
答案2
得分: 0
你可以尝试使用自定义符号来添加注释。
同步方法的注释
同步方法示例
英文:
You can try a user-defined notation with adding a note.
Note for synchronized methods
Example for synchronzed method
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论