Package io.servicetalk.transport.api
Interface ServerListenContext
- All Known Subinterfaces:
GrpcServerContext,HttpServerContext,ServerContext
- All Known Implementing Classes:
DelegatingHttpServiceContext,HttpServiceContext,NettyServerContext
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Context for controlling listen behavior.
-
Method Summary
Modifier and TypeMethodDescriptionvoidacceptConnections(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
falsevalue 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
backlogor OS wide settings:- Linux: SOMAXCONN
- MacOS/BSD: kern.ipc.somaxconn / kern.ipc.soacceptqueue
Depending on how long this stays in the
falsestate, 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.
-