wood burning stoves*
The moose likes OO, Patterns, UML and Refactoring and the fly likes Synchronized and UML Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "Synchronized and UML" Watch "Synchronized and UML" New topic

Synchronized and UML

David Ulicny
Ranch Hand

Joined: Aug 04, 2004
Posts: 724
Is in UML any possibility to show in diagram that some method is synchronized?

SCJP<br />SCWCD <br />ICSD(286)<br />MCP 70-216
Ko Ko Naing
Ranch Hand

Joined: Jun 08, 2002
Posts: 3178
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...

Co-author of SCMAD Exam Guide, Author of JMADPlus
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

Use the Sterotype for synchronized in the Class diagram.

Sathya Srinivasan
Ranch Hand

Joined: Jan 29, 2002
Posts: 379
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.

Cheers, Sathya Srinivasan - SCJP 1.2, SCWCD 1.2, SCMAD 1.0
Co-Author of Whizlabs SCMAD Certification Exam Simulator and SCMAD Exam Guide Book
Scott Ambler
Ranch Hand

Joined: Dec 12, 2003
Posts: 608
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

<a href="http://www-306.ibm.com/software/rational/bios/ambler.html" target="_blank" rel="nofollow">Scott W. Ambler</a><br />Practice Leader Agile Development, IBM Rational<br /> <br />Now available: <a href="http://www.ambysoft.com/books/refactoringDatabases.html" target="_blank" rel="nofollow">Refactoring Databases: Evolutionary Database Design</a>
I agree. Here's the link: http://aspose.com/file-tools
subject: Synchronized and UML