UML类图,如何显示类扩展线程?
2022-09-03 09:43:20
我有一个名为ServerSide的类,其中另一个类称为Cserver。下面的代码片段应该解释我正在谈论的内容:
public static void main (String [] args) throws Exception
{
System.out.println("The server is running.");
int clientnumber = 1;
ServerSocket server = new ServerSocket(9090);
try
{
while (true)
{
new cserver(server.accept(), clientnumber++).start();
}
}finally
{
server.close();
}
}
private static class cserver extends Thread
{
private Socket socket;
private int clientnumber;
private ConnectionHandler c_handler;
private Protocol protocol;
public cserver(Socket socket, int clientnumber)
{
this.socket = socket;
this.clientnumber = clientnumber;
log("New connection with Client: " + clientnumber + " at " + socket);
}
我想在UML中制作一个类图,显示两个类之间的关系,因为我不确定如何在UML中绘制它。它会是一个协会吗?谢谢