borisssmidtCET commented on code in PR #14597:
URL: https://github.com/apache/kafka/pull/14597#discussion_r1415314693


##########
clients/src/main/java/org/apache/kafka/common/security/auth/KafkaPrincipal.java:
##########
@@ -53,7 +53,12 @@ public KafkaPrincipal(String principalType, String name) {
     }
 
     public KafkaPrincipal(String principalType, String name, boolean 
tokenAuthenticated) {
-        this.principalType = requireNonNull(principalType, "Principal type 
cannot be null");
+        //Sharing USER_TYPE reference.
+        if (principalType.equals(USER_TYPE)) {

Review Comment:
   This improves the performance since the principal type is almost always a 
'USER_TYPE'  so you can make sure the same reference is used. 



-- 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to