Skip to content

Commit

Permalink
[MINOR] test: Fix ConcurrentModifiedException while use TestAppender (#…
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
maobaolong authored Dec 11, 2024
1 parent 0552d3b commit 44bfd0d
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public synchronized int logCount(Pattern pattern) {
}

@Override
public void append(LogEvent event) {
public synchronized void append(LogEvent event) {
events.add(event);
}
}
Expand Down

0 comments on commit 44bfd0d

Please sign in to comment.