public class ReservedStreamingHttpConnectionFilter extends java.lang.Object implements FilterableReservedStreamingHttpConnection
ReservedStreamingHttpConnectionFilter
that delegates all methods to a different
ReservedStreamingHttpConnectionFilter
.Modifier | Constructor and Description |
---|---|
protected |
ReservedStreamingHttpConnectionFilter(FilterableReservedStreamingHttpConnection delegate)
Create a new instance.
|
Modifier and Type | Method and Description |
---|---|
Completable |
closeAsync()
Used to close/shutdown a resource.
|
Completable |
closeAsyncGracefully()
Used to close/shutdown a resource, similar to
AsyncCloseable.closeAsync() , but attempts to cleanup state before
abruptly closing. |
HttpConnectionContext |
connectionContext()
Get the
HttpConnectionContext . |
protected FilterableReservedStreamingHttpConnection |
delegate()
Get the
ReservedStreamingHttpConnection this method delegates to. |
HttpExecutionContext |
executionContext()
Get the
HttpExecutionContext used during construction of this object. |
StreamingHttpResponseFactory |
httpResponseFactory()
Get a
StreamingHttpResponseFactory . |
StreamingHttpRequest |
newRequest(HttpRequestMethod method,
java.lang.String requestTarget)
Create a new
HttpRequestFactory . |
Completable |
onClose()
Returns a
Completable that is notified once the ListenableAsyncCloseable was closed. |
Completable |
releaseAsync()
Releases this reserved
FilterableStreamingHttpConnection to be used for subsequent requests. |
Single<StreamingHttpResponse> |
request(HttpExecutionStrategy strategy,
StreamingHttpRequest request)
Send a
request using the specified strategy . |
protected Single<StreamingHttpResponse> |
request(StreamingHttpRequester delegate,
HttpExecutionStrategy strategy,
StreamingHttpRequest request)
Called when the filter needs to delegate the request using the provided
StreamingHttpRequester on
which to call StreamingHttpRequester.request(HttpExecutionStrategy, StreamingHttpRequest) . |
java.lang.String |
toString() |
<T> Publisher<? extends T> |
transportEventStream(HttpEventKey<T> eventKey)
Returns a
Publisher that gives the current value of a transport event as well as subsequent changes to
the event value as long as the PublisherSource.Subscriber has expressed enough demand. |
protected ReservedStreamingHttpConnectionFilter(FilterableReservedStreamingHttpConnection delegate)
delegate
- The FilterableReservedStreamingHttpConnection
to delegate all calls topublic Completable releaseAsync()
FilterableReservedStreamingHttpConnection
FilterableStreamingHttpConnection
to be used for subsequent requests.
This method must be idempotent, i.e. calling multiple times must not have side-effects.releaseAsync
in interface FilterableReservedStreamingHttpConnection
Completable
that is notified on releaseAsync.public HttpConnectionContext connectionContext()
FilterableStreamingHttpConnection
HttpConnectionContext
.connectionContext
in interface FilterableStreamingHttpConnection
HttpConnectionContext
.public <T> Publisher<? extends T> transportEventStream(HttpEventKey<T> eventKey)
FilterableStreamingHttpConnection
Publisher
that gives the current value of a transport event as well as subsequent changes to
the event value as long as the PublisherSource.Subscriber
has expressed enough demand.
This is designed for events produced by the transport, and consumed by filters interested in transport behavior which is not directly involved in the data path.
transportEventStream
in interface FilterableStreamingHttpConnection
T
- Type of the event value.eventKey
- Name of the event to fetch.Publisher
for the event values.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 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 FilterableReservedStreamingHttpConnection delegate()
ReservedStreamingHttpConnection
this method delegates to.ReservedStreamingHttpConnection
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.