Skip to content

Commit 8217a9e

Browse files
committed
Fix Missing Re-Interrupts
1 parent 4f20673 commit 8217a9e

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,12 +208,15 @@ public final boolean initialize() {
208208
addOrModifyTopicsIfNeeded(adminClient, newTopics);
209209
return true;
210210
}
211-
catch (Exception e) {
211+
catch (InterruptedException ex) {
212+
Thread.currentThread().interrupt();
213+
}
214+
catch (Exception ex) {
212215
if (!this.initializingContext || this.fatalIfBrokerNotAvailable) {
213-
throw new IllegalStateException("Could not configure topics", e);
216+
throw new IllegalStateException("Could not configure topics", ex);
214217
}
215218
else {
216-
LOGGER.error(e, "Could not configure topics");
219+
LOGGER.error(ex, "Could not configure topics");
217220
}
218221
}
219222
finally {
@@ -267,6 +270,9 @@ public String clusterId() {
267270
try (AdminClient client = createAdmin()) {
268271
this.clusterId = client.describeCluster().clusterId().get(this.operationTimeout, TimeUnit.SECONDS);
269272
}
273+
catch (InterruptedException ex) {
274+
Thread.currentThread().interrupt();
275+
}
270276
catch (Exception ex) {
271277
LOGGER.error(ex, "Could not obtaine cluster info");
272278
}

spring-kafka/src/main/java/org/springframework/kafka/listener/AbstractMessageListenerContainer.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,11 @@ protected void checkTopics() {
510510
entry.getValue().get(this.topicCheckTimeout, TimeUnit.SECONDS);
511511
return false;
512512
}
513-
catch (@SuppressWarnings("unused") Exception e) {
513+
catch (InterruptedException ex) {
514+
Thread.currentThread().interrupt();
515+
return true;
516+
}
517+
catch (@SuppressWarnings("unused") Exception ex) {
514518
return true;
515519
}
516520
})

0 commit comments

Comments
 (0)