public class CompositeSendInterceptor extends Object implements SendInterceptor
SendInterceptor
instances that will call each other in turn.
Construct a chain by passing a list of SendInterceptor
s to the
of
method.
CompositeSendInterceptor composite = CompositeSendInterceptor.of(
new SendInterceptorA(),
new SendInterceptorB(),
new SendInterceptorC());
With this chain, SendInterceptorA
will be called first, and
the next
parameter of each of its around
methods
will refer to the future returned by SendInterceptorB
.
This class is thread-safe.
Modifier and Type | Method and Description |
---|---|
CompletableFuture<List<io.netty.handler.codec.smtp.SmtpResponse>> |
aroundData(Supplier<CompletableFuture<List<io.netty.handler.codec.smtp.SmtpResponse>>> next)
Called before data is sent.
|
CompletableFuture<List<io.netty.handler.codec.smtp.SmtpResponse>> |
aroundPipelinedSequence(List<io.netty.handler.codec.smtp.SmtpRequest> requests,
Supplier<CompletableFuture<List<io.netty.handler.codec.smtp.SmtpResponse>>> next)
Called before a pipelined series of requests is sent.
|
CompletableFuture<List<io.netty.handler.codec.smtp.SmtpResponse>> |
aroundRequest(io.netty.handler.codec.smtp.SmtpRequest request,
Supplier<CompletableFuture<List<io.netty.handler.codec.smtp.SmtpResponse>>> next)
Called before a request is sent.
|
List<SendInterceptor> |
getSendInterceptors() |
static CompositeSendInterceptor |
of(List<SendInterceptor> interceptors)
Creates a chain of
SendInterceptor instances that will call each other in turn. |
static CompositeSendInterceptor |
of(SendInterceptor... sendInterceptors)
Creates a chain of
SendInterceptor instances that will call each other in turn. |
public static CompositeSendInterceptor of(SendInterceptor... sendInterceptors)
SendInterceptor
instances that will call each other in turn.public static CompositeSendInterceptor of(List<SendInterceptor> interceptors)
SendInterceptor
instances that will call each other in turn.public List<SendInterceptor> getSendInterceptors()
public CompletableFuture<List<io.netty.handler.codec.smtp.SmtpResponse>> aroundRequest(io.netty.handler.codec.smtp.SmtpRequest request, Supplier<CompletableFuture<List<io.netty.handler.codec.smtp.SmtpResponse>>> next)
SendInterceptor
aroundRequest
in interface SendInterceptor
request
- the request that will be sentnext
- supplies a future that will complete when the request has been sent and a response receivednext.get()
, a CompletableFuture
derived from it, or an exceptional future if the send should
be abortedpublic CompletableFuture<List<io.netty.handler.codec.smtp.SmtpResponse>> aroundData(Supplier<CompletableFuture<List<io.netty.handler.codec.smtp.SmtpResponse>>> next)
SendInterceptor
aroundData
in interface SendInterceptor
next
- supplies a future that will complete when the data has been sent and a response receivednext.get()
, a CompletableFuture
derived from it, or an exceptional future if the send should
be abortedpublic CompletableFuture<List<io.netty.handler.codec.smtp.SmtpResponse>> aroundPipelinedSequence(List<io.netty.handler.codec.smtp.SmtpRequest> requests, Supplier<CompletableFuture<List<io.netty.handler.codec.smtp.SmtpResponse>>> next)
SendInterceptor
aroundPipelinedSequence
in interface SendInterceptor
requests
- the requests that will be sentnext
- supplies a future that will complete when the requests have been sent and responses receivednext.get()
, a CompletableFuture
derived from it, or an exceptional future if the send should
be abortedCopyright © 2018. All rights reserved.