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

CurryMaster picture CurryMaster · Apr 19, 2014 · Viewed 52.3k times · Source

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

Answer

Angular University picture Angular University · Apr 19, 2014

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

enter image description here