Skip to content

Commit 76b41e8

Browse files
authored
Add AnnotationClassOrMethodPointcut.hashCode() impl
Due to the absence of a `hashCode()` implementation, proxies for the `AnnotationClassOrMethodPointcut` class are regenerated each time, which causes them to be stored in the `org.springframework.cglib.core.internal.LoadingCache` (with `RetryConfiguration.AnnotationClassOrMethodPointcut` being part of the composite key for this object). This results in an excessive accumulation of generated proxies in memory, ultimately leading to metaspace overflow.
1 parent 4886b75 commit 76b41e8

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Diff for: src/main/java/org/springframework/retry/annotation/RetryConfiguration.java

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2006-2023 the original author or authors.
2+
* Copyright 2006-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -21,6 +21,7 @@
2121
import java.util.ArrayList;
2222
import java.util.LinkedHashSet;
2323
import java.util.List;
24+
import java.util.Objects;
2425
import java.util.Set;
2526
import java.util.concurrent.atomic.AtomicBoolean;
2627

@@ -68,6 +69,7 @@
6869
* @author Markus Heiden
6970
* @author Gary Russell
7071
* @author Yanming Zhou
72+
* @author Evgeny Lazarev
7173
* @since 1.1
7274
*
7375
*/
@@ -242,6 +244,11 @@ public boolean equals(Object other) {
242244
return ObjectUtils.nullSafeEquals(this.methodResolver, otherAdvisor.methodResolver);
243245
}
244246

247+
@Override
248+
public int hashCode() {
249+
return Objects.hash(this.methodResolver);
250+
}
251+
245252
}
246253

247254
private final class AnnotationClassOrMethodFilter extends AnnotationClassFilter {

0 commit comments

Comments
 (0)