cshannon commented on code in PR #2133:
URL: https://github.com/apache/activemq/pull/2133#discussion_r3605920130


##########
activemq-broker/src/main/java/org/apache/activemq/broker/TransportConnector.java:
##########
@@ -337,7 +338,8 @@ protected TransportServer createTransportServer() throws 
IOException, URISyntaxE
             throw new IllegalArgumentException(
                     "You must specify the brokerService property. Maybe this 
connector should be added to a broker?");
         }
-        return TransportFactorySupport.bind(brokerService, uri);
+        SslContext ctx = sslContext != null ? sslContext : 
brokerService.getSslContext();

Review Comment:
   These comments fall into the "nit" category aren't aren't required but I was 
just thinking this might be a good time to use Optional. This is not on a hot 
path so it won't create a lot of extra objects to clean up so it might make it 
a bit cleaner (this comment applies for all the places looking up the ssl 
context is used with a ternary operator.)  
   
   ```java
   return TransportFactorySupport.bind(brokerService, uri,
       Optional.ofNullable(sslContext).orElseGet(() -> 
brokerService.getSslContext()));
   ```
   or 
   ```java
   return TransportFactorySupport.bind(brokerService, uri,
                   
Optional.ofNullable(sslContext).orElse(brokerService.getSslContext()));
   ```
   
   Using a helper method:
   
   ```java
   public SslContext getAppliedSslContext() {
      return sslContext != null ? sslContext : brokerService.getSslContext();
   }
   ```



-- 
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]
For further information, visit: https://activemq.apache.org/contact


Reply via email to