gnodet-bot commented on code in PR #30526:
URL: https://github.com/apache/camel/pull/30526#discussion_r4649480022
##########
components/camel-netty-http/src/main/java/org/apache/camel/component/netty/http/handlers/HttpServerChannelHandler.java:
##########
@@ -555,4 +592,94 @@ protected Exchange createExchange(ChannelHandlerContext
ctx, Object message) thr
return exchange;
}
+
+ /**
+ * A streamed reply that closes the body stream of the request with it.
The outbound streamer closes the reply once
+ * it is written, when the write fails, or when the connection is closed.
Everything else is the reply as built by
+ * the binding.
+ */
+ private static final class StreamedReply extends
OutboundStreamHttpResponse {
+ private final OutboundStreamHttpResponse reply;
+ private boolean closed;
+ private InputStream requestStream;
+
+ StreamedReply(OutboundStreamHttpResponse reply) {
+ super(InputStream.nullInputStream(), reply);
Review Comment:
💡 **Minor observation:** `StreamedReply` calls
`super(InputStream.nullInputStream(), reply)`, which causes
`OutboundStreamHttpResponse`'s constructor to allocate `new
HttpChunkedInput(new ChunkedStream(nullInputStream))` — objects that are never
used (all methods are overridden to delegate to `reply` instead).
This is harmless (`InputStream.nullInputStream().close()` is a no-op), but
the dead allocation is slightly wasteful. A cleaner design would be to not
extend `OutboundStreamHttpResponse` and instead implement the relevant Netty
interface directly — though that would require more structural change. No
action required for this PR, just noting it as a potential future cleanup.
--
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]