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 ConnectionAcceptor
ACCEPT_ALL
ACCEPT all connections.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Completable
accept(ConnectionContext context)
Evaluate the passedConnectionContext
to accept or reject.default ConnectionAcceptor
append(ConnectionAcceptor after)
Returns a composedConnectionAcceptor
that first appliesthis
ConnectionAcceptor
, and if this is successful then appliesafter
ConnectionAcceptor
.default Completable
closeAsync()
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 passedConnectionContext
to accept or reject. If the returnedCompletable
terminates successfully then the passedConnectionContext
will be accepted, otherwise rejected.- Parameters:
context
- theConnectionContext
to evaluate.- Returns:
Completable
, which when terminated successfully, the passedConnectionContext
is accepted, otherwise rejected.
-
append
default ConnectionAcceptor append(ConnectionAcceptor after)
Returns a composedConnectionAcceptor
that first appliesthis
ConnectionAcceptor
, and if this is successful then appliesafter
ConnectionAcceptor
.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
- theConnectionAcceptor
to apply afterthis
ConnectionAcceptor
is applied- Returns:
- a composed
ConnectionAcceptor
that first appliesthis
ConnectionAcceptor
, and if this is successful then appliesafter
ConnectionAcceptor
.
-
closeAsync
default Completable closeAsync()
Description copied from interface:AsyncCloseable
Used to close/shutdown a resource.- Specified by:
closeAsync
in interfaceAsyncCloseable
- Returns:
- A
Completable
that is notified once the close is complete.
-
-