Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Synchronized and UML

 
David Ulicny
Ranch Hand
Posts: 724
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is in UML any possibility to show in diagram that some method is synchronized?
 
Ko Ko Naing
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Simply inserting the "synchronized" keyword is alright, I guess... But once I read in an online article that UML cannot depict the final, native, synchronised, transient and volatile modifiers that is available in Java...

That's why wherever I need to show the developers that synchronized methods must be used in their code, I simply use a small "synchronized" keyword beside the name of the method...
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use the Sterotype for synchronized in the Class diagram.
 
Sathya Srinivasan
Ranch Hand
Posts: 379
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I remember right, activity diagrams have specific symbols to show synchronization.

Not sure if the arrow in the Sequence diagram can be used to depict synchronization.
 
Scott Ambler
author
Ranch Hand
Posts: 608
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On activity diagrams you can easily show parallel activities, an example of which is depicted at http://www.agilemodeling.com/artifacts/activityDiagram.htm#Figure2Swimlanes (it's the parallel black bars).

The sychronized stereotype can also be applied to methods as another poster indicates.

- Scott
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic