mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-17 16:39:29 +00:00
Use ArrayList instead of LinkedList in CompositeRetryListener
CompositeRetryListener currently uses LinkedList to store registered listeners. The primary operation on this list is iteration (traversing all listeners on every retry lifecycle event). ArrayList provides better iteration performance due to better cache locality and lower memory overhead. Closes gh-37231 Signed-off-by: Chengang Guan <guanchengang@qq.com>
This commit is contained in:
+2
-2
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.core.retry.support;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
@@ -42,7 +42,7 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public class CompositeRetryListener implements RetryListener {
|
||||
|
||||
private final List<RetryListener> listeners = new LinkedList<>();
|
||||
private final List<RetryListener> listeners = new ArrayList<>();
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user