Reputation: 351
I've got a class which creates an instance of another class. "ServerThread" configures a socket for an incoming connection, and "ServerLogic" waits for any incoming messages.
ServerThread creates an instance of ServerLogic, and invokes the "run" method in ServerLogic. ServerThread does not store a reference to the ServerLogic object, and because these will be running on the same thread, ServerThread will be on hold until ServerLogic stops listening/the socket is closed.
Here is an image of the two classes I'm talking about:
How would I represent this kind of relationship in a UML class diagram?
Thanks.
Upvotes: 5
Views: 6221
Reputation: 6780
Represent it as a 1 to 1 relationship where ServerLogic is a dependent class of ServerThread.
Here is general info on UML if you need that: http://www.cs.bsu.edu/homepages/pvg/misc/uml/
Upvotes: 0
Reputation: 73456
I understand that your ServerThread
and ServerLogic
are structurally independent: no reference between each other is maintained. So there is no association between them. You could however draw a dependency (dashed line with arrow) from ServerThread
to ServerLogic
with the stereotype «Instantiate»
.
Upvotes: 8