Package org.apache.druid.frame.file
Class FrameFileHttpResponseHandler
java.lang.Object
org.apache.druid.frame.file.FrameFileHttpResponseHandler
- All Implemented Interfaces:
HttpResponseHandler<FrameFilePartialFetch,FrameFilePartialFetch>
public class FrameFileHttpResponseHandler
extends Object
implements HttpResponseHandler<FrameFilePartialFetch,FrameFilePartialFetch>
An
HttpResponseHandler that streams data into a ReadableByteChunksFrameChannel.
It is not required that the request actually fetches an entire frame file. The return object for this handler,
FrameFilePartialFetch, allows callers to tell how much of the file was read in a particular request.
This handler implements backpressure through FrameFilePartialFetch.backpressureFuture(). This allows callers
to back off from issuing the next request, if appropriate. However: the handler does not implement backpressure
through the HttpResponseHandler.TrafficCop mechanism. Therefore, it is important that each request retrieve
a modest amount of data.
The last fetch must be empty (zero content bytes) and must have the header HEADER_LAST_FETCH_NAME set to
HEADER_LAST_FETCH_VALUE. Under these conditions, FrameFilePartialFetch.isLastFetch() returns true.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.druid.java.util.http.client.response.HttpResponseHandler
HttpResponseHandler.TrafficCop -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondone(ClientResponse<FrameFilePartialFetch> clientResponse) Called after the final handleResponse() or handleChunk() call, signifying that no more data will arrive.voidexceptionCaught(ClientResponse<FrameFilePartialFetch> clientResponse, Throwable e) handleChunk(ClientResponse<FrameFilePartialFetch> clientResponse, org.jboss.netty.handler.codec.http.HttpChunk chunk, long chunkNum) Called for chunked responses, indicating another HttpChunk has arrived.handleResponse(org.jboss.netty.handler.codec.http.HttpResponse response, HttpResponseHandler.TrafficCop trafficCop) Handles the initial HttpResponse object that comes back from Netty.
-
Field Details
-
HEADER_LAST_FETCH_NAME
- See Also:
-
HEADER_LAST_FETCH_VALUE
- See Also:
-
-
Constructor Details
-
FrameFileHttpResponseHandler
-
-
Method Details
-
handleResponse
public ClientResponse<FrameFilePartialFetch> handleResponse(org.jboss.netty.handler.codec.http.HttpResponse response, HttpResponseHandler.TrafficCop trafficCop) Description copied from interface:HttpResponseHandlerHandles the initial HttpResponse object that comes back from Netty.- Specified by:
handleResponsein interfaceHttpResponseHandler<FrameFilePartialFetch,FrameFilePartialFetch> - Parameters:
response- response from NettytrafficCop- flow controller, allows resuming suspended reads- Returns:
- response that may be "finished" or "unfinished".
-
handleChunk
public ClientResponse<FrameFilePartialFetch> handleChunk(ClientResponse<FrameFilePartialFetch> clientResponse, org.jboss.netty.handler.codec.http.HttpChunk chunk, long chunkNum) Description copied from interface:HttpResponseHandlerCalled for chunked responses, indicating another HttpChunk has arrived.- Specified by:
handleChunkin interfaceHttpResponseHandler<FrameFilePartialFetch,FrameFilePartialFetch> - Parameters:
clientResponse- last response returned by the prior handleResponse() or handleChunk()chunk- the new chunk of datachunkNum- the sequence number of this chunk (increases monotonically)- Returns:
- response that may be "finished" or "unfinished".
-
done
public ClientResponse<FrameFilePartialFetch> done(ClientResponse<FrameFilePartialFetch> clientResponse) Description copied from interface:HttpResponseHandlerCalled after the final handleResponse() or handleChunk() call, signifying that no more data will arrive.- Specified by:
donein interfaceHttpResponseHandler<FrameFilePartialFetch,FrameFilePartialFetch> - Parameters:
clientResponse- last response returned by handleResponse() or handleChunk()- Returns:
- response containing an object to hand back to the caller. It must be a "finished" response.
-
exceptionCaught
- Specified by:
exceptionCaughtin interfaceHttpResponseHandler<FrameFilePartialFetch,FrameFilePartialFetch>
-