Interface ServerConnection

All Known Implementing Classes:
Http1Connection, Http2Connection, WsConnection

public interface ServerConnection
Server connection abstraction, used by any provider to handle a socket connection.
  • Method Summary

    Modifier and Type
    close(boolean interrupt)
    Close a connection.
    handle(Semaphore requestSemaphore)
    Start handling the connection.
    How long is this connection idle.
  • Method Details

    • handle

      void handle(Semaphore requestSemaphore) throws InterruptedException
      Start handling the connection. Data is provided through ServerConnectionSelector.connection(io.helidon.webserver.ConnectionContext).
      requestSemaphore - semaphore that is responsible for maximal concurrent request limit, the connection implementation is responsible for acquiring a permit from the semaphore for the duration of a request, and releasing it when the request ends; please be very careful, as this may lead to complete stop of the server if incorrectly implemented
      InterruptedException - to interrupt any waiting state and terminate this connection
    • idleTime

      Duration idleTime()
      How long is this connection idle. This is a duration from the last request to now.
      idle duration
    • close

      void close(boolean interrupt)
      Close a connection. This may be called during shutdown of the server, or when idle timeout is reached.
      interrupt - whether to interrupt in progress requests (always interrupts idle requests waiting for initial request data)