Skip to content

Commit 052bed7

Browse files
authored
GH-4027: Fix updateClusterId logic to expected == null
Fixed: #4027 Change condition from `!= null` to `== null` to only fetch `clusterId` when it's not set yet. This avoids unnecessary broker calls and improves performance while maintaining consistency with `clusterId()` method This is a fix for an important omission after #2859 Signed-off-by: Choi Wang Gyu <[email protected]> **Auto-cherry-pick to `3.3.x`**
1 parent 798ce4b commit 052bed7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

spring-kafka/src/main/java/org/springframework/kafka/core/KafkaAdmin.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
* @author Valentina Armenise
8282
* @author Anders Swanson
8383
* @author Omer Celik
84+
* @author Choi Wang Gyu
8485
*
8586
* @since 1.3
8687
*/
@@ -300,7 +301,7 @@ public final boolean initialize() {
300301
private void updateClusterId(Admin adminClient) throws InterruptedException, ExecutionException, TimeoutException {
301302
try {
302303
this.clusterIdLock.lock();
303-
if (this.clusterId != null) {
304+
if (this.clusterId == null) {
304305
this.clusterId = adminClient.describeCluster().clusterId().get(this.operationTimeout,
305306
TimeUnit.SECONDS);
306307
}

0 commit comments

Comments
 (0)