ivankelly commented on a change in pull request #6074: PIP-55: Refresh
Authentication Credentials
URL: https://github.com/apache/pulsar/pull/6074#discussion_r369980020
##########
File path:
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/PulsarChannelInitializer.java
##########
@@ -78,6 +97,19 @@ protected void initChannel(SocketChannel ch) throws
Exception {
// ServerCnx ends up reading higher number of messages and broker can
not throttle the messages by disabling
// auto-read.
ch.pipeline().addLast("flowController", new FlowControlHandler());
- ch.pipeline().addLast("handler", new ServerCnx(pulsar));
+ ServerCnx cnx = new ServerCnx(pulsar);
+ ch.pipeline().addLast("handler", cnx);
+
+ connections.put(ch.remoteAddress(), cnx);
+ }
+
+ private void refreshAuthenticationCredentials() {
+ connections.asMap().values().forEach(cnx -> {
+ try {
+ cnx.refreshAuthenticationCredentials();
+ } catch (Throwable t) {
+ log.warn("[{}] Failed to refresh auth credentials",
cnx.getRemoteAddress());
Review comment:
Since you're using Cache to hold the connections, and the lifetime of the
entry in connections is based on whether it's been GC'd, this will likely spam
the logs. Maybe only log if after throwing, the cnx is still in connected state.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services