Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
405 views
in Technique[技术] by (71.8m points)

java - UML Class diagram, how to show a Class extends thread?

I have a class called ServerSide in which another class resides called Cserver. The following code fragment should explain what I am talking about:

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);
    }

I want to make a class diagram in UML which shows the relationship between the two classes, as I am unsure as how this can be drawn in UML. Will it be an association? Thanks

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

This would be the diagram, it's an inheritance relation (IS-A):

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...