showuon commented on code in PR #12179:
URL: https://github.com/apache/kafka/pull/12179#discussion_r894213689


##########
clients/src/main/java/org/apache/kafka/common/security/authenticator/SaslServerAuthenticator.java:
##########
@@ -673,30 +673,26 @@ private long 
calcCompletionTimesAndReturnSessionLifetimeMs() {
             Long credentialExpirationMs = (Long) saslServer
                     
.getNegotiatedProperty(SaslInternalConfigs.CREDENTIAL_LIFETIME_MS_SASL_NEGOTIATED_PROPERTY_KEY);
             Long connectionsMaxReauthMs = 
connectionsMaxReauthMsByMechanism.get(saslMechanism);
-            if (credentialExpirationMs != null || connectionsMaxReauthMs != 
null) {
+            boolean maxReauthSet = connectionsMaxReauthMs != null && 
connectionsMaxReauthMs > 0;

Review Comment:
   `boolean maxReauthSet = connectionsMaxReauthMs != null && 
connectionsMaxReauthMs > 0;`
   
   Make sense to me.



##########
clients/src/test/java/org/apache/kafka/common/network/SelectorTest.java:
##########
@@ -781,14 +781,13 @@ public void testConnectDisconnectDuringInSinglePoll() 
throws Exception {
         when(kafkaChannel.selectionKey()).thenReturn(selectionKey);
         when(selectionKey.channel()).thenReturn(SocketChannel.open());
         when(selectionKey.readyOps()).thenReturn(SelectionKey.OP_CONNECT);
+        when(selectionKey.attachment()).thenReturn(kafkaChannel);
 
-        selectionKey.attach(kafkaChannel);
         Set<SelectionKey> selectionKeys = Utils.mkSet(selectionKey);
         selector.pollSelectionKeys(selectionKeys, false, System.nanoTime());
 
         assertFalse(selector.connected().contains(kafkaChannel.id()));
         assertTrue(selector.disconnected().containsKey(kafkaChannel.id()));
-        assertNull(selectionKey.attachment());

Review Comment:
   Thanks for the explanation. I agree with the change. Make sense.



-- 
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]

Reply via email to