This is an automated email from the ASF dual-hosted git repository.
maobaolong pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-uniffle.git
The following commit(s) were added to refs/heads/master by this push:
new 44bfd0da8 [MINOR] test: Fix ConcurrentModifiedException while use
TestAppender (#2285)
44bfd0da8 is described below
commit 44bfd0da8a501f8d1d95cf4ef28745304553de50
Author: maobaolong <[email protected]>
AuthorDate: Wed Dec 11 09:20:33 2024 +0800
[MINOR] test: Fix ConcurrentModifiedException while use TestAppender (#2285)
### What changes were proposed in this pull request?
Fix ConcurrentModifiedException while use TestAppender
### Why are the changes needed?
```
[ERROR] testNewAppWhileCheckLeak{ExtensionContext} Time elapsed: 0.3 s
<<< ERROR!
java.util.ConcurrentModificationException
at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:911)
at java.util.ArrayList$Itr.next(ArrayList.java:861)
at
org.apache.uniffle.common.log.TestLoggerExtension$TestAppender.wasLogged(TestLoggerExtension.java:106)
at
org.apache.uniffle.common.log.TestLoggerExtension.wasLogged(TestLoggerExtension.java:73)
at
org.apache.uniffle.server.storage.LocalStorageManagerTest.testNewAppWhileCheckLeak(LocalStorageManagerTest.java:399)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
```
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
Existing UTs.
---
.../test/java/org/apache/uniffle/common/log/TestLoggerExtension.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git
a/common/src/test/java/org/apache/uniffle/common/log/TestLoggerExtension.java
b/common/src/test/java/org/apache/uniffle/common/log/TestLoggerExtension.java
index df0e815eb..ac3f968e3 100644
---
a/common/src/test/java/org/apache/uniffle/common/log/TestLoggerExtension.java
+++
b/common/src/test/java/org/apache/uniffle/common/log/TestLoggerExtension.java
@@ -134,7 +134,7 @@ public class TestLoggerExtension implements
BeforeEachCallback, AfterEachCallbac
}
@Override
- public void append(LogEvent event) {
+ public synchronized void append(LogEvent event) {
events.add(event);
}
}