Package io.servicetalk.transport.api
Interface ServerListenContext
- All Known Subinterfaces:
GrpcServerContext
,HttpServerContext
,ServerContext
- All Known Implementing Classes:
DelegatingHttpServiceContext
,HttpServiceContext
,NettyServerContext
public interface ServerListenContext
Context for controlling listen behavior.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
acceptConnections
(boolean accept) Toggles the server's ability to accept new connections.
-
Method Details
-
acceptConnections
void acceptConnections(boolean accept) Toggles the server's ability to accept new connections.Passing a
false
value will signal the server to stop accepting new connections. It won't affect any other interactions to currently open connections (i.e., reads / writes).Depending on the transport, connections may still get ESTABLISHED, see
backlog
or OS wide settings:- Linux: SOMAXCONN
- MacOS/BSD: kern.ipc.somaxconn / kern.ipc.soacceptqueue
Depending on how long this stays in the
false
state, it may affect other timeouts (i.e., connect-timeout or idleness) on the peer-side and/or the other flows to the peer (i.e., proxies).Considerations:
- Upon resumption,
accept == true
, backlogged connections will be processed first, which may be inactive by that time. - The effect of toggling connection acceptance may be lazy evaluated (implementation detail), meaning
that connections may still go through even after setting this to
false
.
- Parameters:
accept
- Toggles the server's accepting connection ability.
-