You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
GH-3062: Fix KafkaBinderMetrics for resource leaks
Fixes: #3062
The `KafkaBinderMetrics` creates `KafkaConsumer` instances and schedule the fix rate
task for them, but never closes them even when the `scheduler` is shut downed
* Implement a `Lifecycle` contract in the `KafkaBinderMetrics` and call `close()`
from the `stop()` to satisfy CRaC resource management expectations.
* Also close all the `KafkaConsumer` instances from the `metadataConsumers`
**Cherry-pick to `4.1.x`**
Copy file name to clipboardExpand all lines: binders/kafka-binder/spring-cloud-stream-binder-kafka/src/main/java/org/springframework/cloud/stream/binder/kafka/KafkaBinderMetrics.java
+53-10Lines changed: 53 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
/*
2
-
* Copyright 2016-2024 the original author or authors.
2
+
* Copyright 2016-2025 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
Copy file name to clipboardExpand all lines: binders/kafka-binder/spring-cloud-stream-binder-kafka/src/test/java/org/springframework/cloud/stream/binder/kafka/KafkaBinderMetricsTest.java
+5-3Lines changed: 5 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
/*
2
-
* Copyright 2016-2024 the original author or authors.
2
+
* Copyright 2016-2025 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -57,6 +57,7 @@
57
57
* @author Tomek Szmytka
58
58
* @author Nico Heller
59
59
* @author Kurt Hong
60
+
* @author Artem Bilan
60
61
*/
61
62
classKafkaBinderMetricsTest {
62
63
@@ -346,10 +347,11 @@ public void usesBeginningOffsetIfNoCommittedOffsetFound() {
0 commit comments