lhotari commented on code in PR #15366:
URL: https://github.com/apache/pulsar/pull/15366#discussion_r861030068
##########
pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/ProxyConnection.java:
##########
@@ -216,18 +234,26 @@ public void channelRead(final ChannelHandlerContext ctx,
Object msg) throws Exce
break;
case ProxyConnectionToBroker:
- // Pass the buffer to the outbound connection and schedule next
read
- // only if we can write on the connection
- ProxyService.OPS_COUNTER.inc();
- if (msg instanceof ByteBuf) {
- int bytes = ((ByteBuf) msg).readableBytes();
-
directProxyHandler.getInboundChannelRequestsRate().recordEvent(bytes);
- ProxyService.BYTES_COUNTER.inc(bytes);
+ if (directProxyHandler != null) {
+ ProxyService.OPS_COUNTER.inc();
+ if (msg instanceof ByteBuf) {
+ int bytes = ((ByteBuf) msg).readableBytes();
+
directProxyHandler.getInboundChannelRequestsRate().recordEvent(bytes);
+ ProxyService.BYTES_COUNTER.inc(bytes);
+ }
+ directProxyHandler.outboundChannel.writeAndFlush(msg)
Review Comment:
Actually there were dependencies to outboundChannel from ProxyStats too. I
think it's better to do that refactoring in a separate PR since it results in
quite a few changes. I did an experiment with
https://github.com/lhotari/pulsar/commit/7d843d1a2755be26068fd561d64677e9c68c869f
, but that doesn't include all the required changes. There would be the
ProxyStats class to handle too.
--
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]