Skip to content

Commit

Permalink
GH-467: Support concurrent behavior on MetricsRetryListener
Browse files Browse the repository at this point in the history
Fixes #467
  • Loading branch information
huisam authored Sep 11, 2024
1 parent c0a4941 commit 42158ba
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package org.springframework.retry.support;

import java.util.Collections;
import java.util.IdentityHashMap;
import java.util.Map;
import java.util.function.Function;
Expand Down Expand Up @@ -53,6 +54,7 @@
* be used to further customize tags on the timers.
*
* @author Artem Bilan
* @author Huijin Hong
* @since 2.0.8
*/
public class MetricsRetryListener implements RetryListener {
Expand All @@ -61,7 +63,8 @@ public class MetricsRetryListener implements RetryListener {

private final MeterRegistry meterRegistry;

private final Map<RetryContext, Timer.Sample> retryContextToSample = new IdentityHashMap<>();
private final Map<RetryContext, Timer.Sample> retryContextToSample = Collections
.synchronizedMap(new IdentityHashMap<>());

private final Timer.Builder retryMeterProvider;

Expand Down

0 comments on commit 42158ba

Please sign in to comment.