eolivelli commented on a change in pull request #11681:
URL: https://github.com/apache/pulsar/pull/11681#discussion_r690162266
##########
File path:
pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/SimpleLoadManagerImpl.java
##########
@@ -1122,7 +1122,7 @@ private String getBrokerAddress() {
return String.format("%s:%s", pulsar.getAdvertisedAddress(),
pulsar.getConfiguration().getWebServicePort().isPresent()
? pulsar.getConfiguration().getWebServicePort().get()
- : pulsar.getConfiguration().getWebServicePortTls());
+ :
pulsar.getConfiguration().getWebServicePortTls().get());
Review comment:
If the Optional has no value `get` will throw a RuntimeException.
What about using orElse(null).
This case won't probably happen but it is better to not risk
##########
File path:
pulsar-websocket/src/main/java/org/apache/pulsar/websocket/service/ProxyServer.java
##########
@@ -120,7 +122,9 @@ public void addRestResources(String basePath, String
javaPackages, String attrib
}
public void start() throws PulsarServerException {
- log.info("Starting web socket proxy at port {}",
conf.getWebServicePort().get());
+ log.info("Starting web socket proxy at port {}", String.join(",",
Arrays.stream(server.getConnectors())
+
.map(ServerConnector.class::cast).map(ServerConnector::getPort).map(Object::toString)
+ .collect(Collectors.toList())));
Review comment:
Nit: there is a Collectors.joining utility method
--
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]