Class DefaultServer

java.lang.Object
com.soklet.core.impl.DefaultServer
All Implemented Interfaces:
Server, AutoCloseable

@ThreadSafe public class DefaultServer extends Object implements Server
Author:
Mark Allen
  • Method Details

    • withPort

    • start

      public void start()
      Description copied from interface: Server
      Starts the server, which makes it able to accept requests from clients.

      If the server is already started, no action is taken.

      This method is designed for internal use by Soklet only and should not be invoked elsewhere.

      Specified by:
      start in interface Server
    • stop

      public void stop()
      Description copied from interface: Server
      Stops the server, which makes it unable to accept requests from clients.

      If the server is already stopped, no action is taken.

      This method is designed for internal use by Soklet only and should not be invoked elsewhere.

      Specified by:
      stop in interface Server
    • isStarted

      Description copied from interface: Server
      Is this server started (that is, able to handle requests from clients)?
      Specified by:
      isStarted in interface Server
      Returns:
      true if the server is started, false otherwise
    • initialize

      public void initialize(@Nonnull SokletConfiguration sokletConfiguration, @Nonnull Server.RequestHandler requestHandler)
      Description copied from interface: Server
      The Soklet instance which manages this Server will invoke this method exactly once at initialization time - this allows Soklet to "talk" to your Server.

      This method is designed for internal use by Soklet only and should not be invoked elsewhere.

      Specified by:
      initialize in interface Server
      Parameters:
      sokletConfiguration - configuration for the Soklet instance that controls this server
      requestHandler - a Soklet-internal request handler which takes a Server-provided request as input and supplies a MarshaledResponse as output for the Server to write back to the client