Class ReflectionServer

java.lang.Object
com.jk.core.reflection.server.ReflectionServer

public class ReflectionServer extends Object
This class represents a server that handles reflection-based method invocations over a network.
Version:
1.0
Author:
Dr. Jalal H. Kiswani
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Represents the default port number for the server.
  • Constructor Summary

    Constructors
    Constructor
    Description
    This method constructs a new ReflectionServer.
    ReflectionServer(int port)
    This method constructs a new ReflectionServer with the provided port.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    This method handles a client connection by creating a ClientHandler to process the client's request.
    void
    This method starts the reflection server and listens for incoming client connections.
    void
    This method stops the reflection server, closing the server socket and stopping ongoing client handling.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • DEFAULT_PORT

      public static final int DEFAULT_PORT
      Represents the default port number for the server.
      See Also:
  • Constructor Details

    • ReflectionServer

      public ReflectionServer()
      This method constructs a new ReflectionServer.
    • ReflectionServer

      public ReflectionServer(int port)
      This method constructs a new ReflectionServer with the provided port.
      Parameters:
      port - Specifies the server port number on which the server should listen.
  • Method Details

    • handleClient

      protected void handleClient(Socket client) throws IOException
      This method handles a client connection by creating a ClientHandler to process the client's request.
      Parameters:
      client - Specifies the connected client's socket.
      Throws:
      IOException - if an I/O exception has occurred.
    • start

      public void start()
      This method starts the reflection server and listens for incoming client connections.
    • stop

      public void stop() throws IOException
      This method stops the reflection server, closing the server socket and stopping ongoing client handling.
      Throws:
      IOException - if an I/O exception has occurred.