public class StreamingHttpClientFilter extends java.lang.Object implements FilterableStreamingHttpClient
StreamingHttpClient
that delegates all methods to a different StreamingHttpClient
.Modifier | Constructor and Description |
---|---|
protected |
StreamingHttpClientFilter(FilterableStreamingHttpClient delegate)
Create a new instance.
|
protected StreamingHttpClientFilter(FilterableStreamingHttpClient delegate)
delegate
- The FilterableStreamingHttpClient
to delegate all calls to.public final Single<StreamingHttpResponse> request(HttpExecutionStrategy strategy, StreamingHttpRequest request)
StreamingHttpRequester
request
using the specified strategy
.request
in interface StreamingHttpRequester
strategy
- HttpExecutionStrategy
to use for executing the request.request
- the request to send.public Single<? extends FilterableReservedStreamingHttpConnection> reserveConnection(HttpExecutionStrategy strategy, HttpRequestMetaData metaData)
FilterableStreamingHttpClient
StreamingHttpConnection
based on provided HttpRequestMetaData
.reserveConnection
in interface FilterableStreamingHttpClient
strategy
- HttpExecutionStrategy
to use.metaData
- Allows the underlying layers to know what StreamingHttpConnection
s are valid to
reserve for future requests
with the same HttpRequestMetaData
.
For example this may provide some insight into shard or other info.Single
that provides the ReservedStreamingHttpConnection
upon completion.public HttpExecutionContext executionContext()
StreamingHttpRequester
HttpExecutionContext
used during construction of this object.
Note that the ExecutionContext.ioExecutor()
will not necessarily be associated with a specific thread
unless that was how this object was built.
executionContext
in interface StreamingHttpRequester
HttpExecutionContext
used during construction of this object.public StreamingHttpResponseFactory httpResponseFactory()
StreamingHttpRequester
StreamingHttpResponseFactory
.httpResponseFactory
in interface StreamingHttpRequester
StreamingHttpResponseFactory
.public Completable onClose()
ListenableAsyncCloseable
Completable
that is notified once the ListenableAsyncCloseable
was closed.onClose
in interface ListenableAsyncCloseable
Completable
that is notified on close.public Completable closeAsync()
AsyncCloseable
closeAsync
in interface AsyncCloseable
CompletableSource
that is notified once the close is complete.public Completable closeAsyncGracefully()
AsyncCloseable
AsyncCloseable.closeAsync()
, but attempts to cleanup state before
abruptly closing. This provides a hint that implementations can use to stop accepting new work and finish in
flight work. This method is implemented on a "best effort" basis and may be equivalent to AsyncCloseable.closeAsync()
.
Note: Implementations may or may not apply a timeout for this operation to complete, if a caller does not
want to wait indefinitely, and are unsure if the implementation applies a timeout, it is advisable to apply a
timeout and force a call to AsyncCloseable.closeAsync()
.
closeAsyncGracefully
in interface AsyncCloseable
Completable
that is notified once the close is complete.public StreamingHttpRequest newRequest(HttpRequestMethod method, java.lang.String requestTarget)
StreamingHttpRequestFactory
HttpRequestFactory
.newRequest
in interface StreamingHttpRequestFactory
method
- The HttpRequestMethod
.requestTarget
- The request target.HttpRequestFactory
.public java.lang.String toString()
toString
in class java.lang.Object
protected final FilterableStreamingHttpClient delegate()
FilterableStreamingHttpClient
this method delegates to.FilterableStreamingHttpClient
this method delegates to.protected Single<StreamingHttpResponse> request(StreamingHttpRequester delegate, HttpExecutionStrategy strategy, StreamingHttpRequest request)
StreamingHttpRequester
on
which to call StreamingHttpRequester.request(HttpExecutionStrategy, StreamingHttpRequest)
.delegate
- The StreamingHttpRequester
to delegate requests to.strategy
- The HttpExecutionStrategy
to use for executing the request.request
- The request to delegate.