Package org.h2.server

Interface Service

All Known Implementing Classes:
PgServer, TcpServer, WebServer

public interface Service
Classes implementing this interface usually provide a TCP/IP listener such as an FTP server. The can be started and stopped, and may or may not allow remote connections.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Check if remote connections are allowed.
    Get the human readable name of the service.
    int
    Gets the port this service is listening on.
    Get the human readable short name of the service.
    Get the URL of this service in a human readable form
    void
    init(String... args)
    Initialize the service from command line options.
    boolean
    Check if a daemon thread should be used.
    boolean
    isRunning(boolean traceError)
    Check if the service is running.
    void
    Listen for incoming connections.
    void
    Start the service.
    void
    Stop the service.
  • Method Details

    • init

      void init(String... args) throws Exception
      Initialize the service from command line options.
      Parameters:
      args - the command line options
      Throws:
      Exception - on failure
    • getURL

      String getURL()
      Get the URL of this service in a human readable form
      Returns:
      the url
    • start

      void start() throws SQLException
      Start the service. This usually means create the server socket. This method must not block.
      Throws:
      SQLException - on failure
    • listen

      void listen()
      Listen for incoming connections. This method blocks.
    • stop

      void stop()
      Stop the service.
    • isRunning

      boolean isRunning(boolean traceError)
      Check if the service is running.
      Parameters:
      traceError - if errors should be written
      Returns:
      if the server is running
    • getAllowOthers

      boolean getAllowOthers()
      Check if remote connections are allowed.
      Returns:
      true if remote connections are allowed
    • getName

      String getName()
      Get the human readable name of the service.
      Returns:
      the name
    • getType

      String getType()
      Get the human readable short name of the service.
      Returns:
      the type
    • getPort

      int getPort()
      Gets the port this service is listening on.
      Returns:
      the port
    • isDaemon

      boolean isDaemon()
      Check if a daemon thread should be used.
      Returns:
      true if a daemon thread should be used