- All Known Implementing Classes:
Http1Connection
,Http2Connection
,WsConnection
public interface ServerConnection
Server connection abstraction, used by any provider to handle a socket connection.
-
Method Details
-
handle
@Deprecated(forRemoval=true, since="4.2.0") default void handle(Semaphore requestSemaphore) throws InterruptedException Deprecated, for removal: This API element is subject to removal in a future version.implementhandle(io.helidon.common.concurrency.limits.Limit)
insteadStart handling the connection. Data is provided throughServerConnectionSelector.connection(io.helidon.webserver.ConnectionContext)
.- Parameters:
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- Throws:
InterruptedException
- to interrupt any waiting state and terminate this connection
-
handle
Start handling the connection. Data is provided throughServerConnectionSelector.connection(io.helidon.webserver.ConnectionContext)
.- Parameters:
limit
- that is responsible for maximal concurrent request limit, the connection implementation is responsible invoking each request within the limit'sLimitAlgorithm.invoke(java.util.concurrent.Callable)
- Throws:
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.- Returns:
- 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.- Parameters:
interrupt
- whether to interrupt in progress requests (always interrupts idle requests waiting for initial request data)
-
handle(io.helidon.common.concurrency.limits.Limit)
instead