Package io.servicetalk.transport.api
Interface ConnectionAcceptor
-
- All Superinterfaces:
AsyncCloseable
- All Known Implementing Classes:
DelegatingConnectionAcceptor
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface ConnectionAcceptor extends AsyncCloseable
A contract that defines the connection acceptance criterion.
-
-
Field Summary
Fields Modifier and Type Field Description static ConnectionAcceptorACCEPT_ALLACCEPT all connections.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Completableaccept(ConnectionContext context)Evaluate the passedConnectionContextto accept or reject.default ConnectionAcceptorappend(ConnectionAcceptor after)Returns a composedConnectionAcceptorthat first appliesthisConnectionAcceptor, and if this is successful then appliesafterConnectionAcceptor.default CompletablecloseAsync()Used to close/shutdown a resource.-
Methods inherited from interface io.servicetalk.concurrent.api.AsyncCloseable
closeAsyncGracefully
-
-
-
-
Field Detail
-
ACCEPT_ALL
static final ConnectionAcceptor ACCEPT_ALL
ACCEPT all connections.
-
-
Method Detail
-
accept
Completable accept(ConnectionContext context)
Evaluate the passedConnectionContextto accept or reject. If the returnedCompletableterminates successfully then the passedConnectionContextwill be accepted, otherwise rejected.- Parameters:
context- theConnectionContextto evaluate.- Returns:
Completable, which when terminated successfully, the passedConnectionContextis accepted, otherwise rejected.
-
append
default ConnectionAcceptor append(ConnectionAcceptor after)
Returns a composedConnectionAcceptorthat first appliesthisConnectionAcceptor, and if this is successful then appliesafterConnectionAcceptor.The order of execution of these filters are in order of append. If 3 filters are added as follows:
this.append(filter1).append(filter2).append(filter3)accepting a connection by a filter wrapped by this filter chain, the order of invocation of these filters will be:this => filter1 => filter2 => filter3- Parameters:
after- theConnectionAcceptorto apply afterthisConnectionAcceptoris applied- Returns:
- a composed
ConnectionAcceptorthat first appliesthisConnectionAcceptor, and if this is successful then appliesafterConnectionAcceptor.
-
closeAsync
default Completable closeAsync()
Description copied from interface:AsyncCloseableUsed to close/shutdown a resource.- Specified by:
closeAsyncin interfaceAsyncCloseable- Returns:
- A
Completablethat is notified once the close is complete.
-
-