sklochkov2 commented on code in PR #19754:
URL: https://github.com/apache/druid/pull/19754#discussion_r3668973735


##########
server/src/main/java/org/apache/druid/server/lookup/cache/LookupCoordinatorManager.java:
##########
@@ -894,14 +897,56 @@ HttpResponseHandler<InputStream, InputStream> 
makeResponseHandler(
         final AtomicReference<String> reasonString
     )
     {
-      return new SequenceInputStreamResponseHandler()
+      return new HttpResponseHandler<InputStream, InputStream>()
       {
+        private final BytesFullResponseHandler delegate = new 
BytesFullResponseHandler();
+        private ClientResponse<BytesFullResponseHolder> delegateResponse;
+
         @Override
         public ClientResponse<InputStream> handleResponse(HttpResponse 
response, TrafficCop trafficCop)
         {
-          returnCode.set(response.getStatus().getCode());
-          reasonString.set(response.getStatus().getReasonPhrase());
-          return super.handleResponse(response, trafficCop);
+          returnCode.set(response.status().code());
+          reasonString.set(response.status().reasonPhrase());
+          delegateResponse = delegate.handleResponse(response, trafficCop);
+          return toInputStream(delegateResponse);
+        }
+
+        @Override
+        public ClientResponse<InputStream> handleChunk(
+            ClientResponse<InputStream> response,
+            HttpContent chunk,
+            long chunkNum
+        )
+        {
+          delegateResponse = delegate.handleChunk(delegateResponse, chunk, 
chunkNum);
+          return toInputStream(delegateResponse);
+        }
+
+        @Override
+        public ClientResponse<InputStream> done(ClientResponse<InputStream> 
response)
+        {
+          delegateResponse = delegate.done(delegateResponse);
+          return toInputStream(delegateResponse);
+        }
+
+        @Override
+        public void exceptionCaught(ClientResponse<InputStream> 
clientResponse, Throwable e)
+        {
+          delegate.exceptionCaught(null, e);
+        }
+
+        private ClientResponse<InputStream> 
toInputStream(ClientResponse<BytesFullResponseHolder> delegateResponse)
+        {
+          if (delegateResponse == null) {
+            return null;
+          }
+          BytesFullResponseHolder holder = delegateResponse.getObj();
+          InputStream stream = holder == null ? null : new 
ByteArrayInputStream(holder.getContent());

Review Comment:
   Addressed this in a subsequent commit.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to