Skip to content

Commit

Permalink
fix: #176.
Browse files Browse the repository at this point in the history
  • Loading branch information
QwQ-dev committed Dec 22, 2024
1 parent 3322302 commit 51c13b4
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import org.jetbrains.annotations.NotNull;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;
Expand Down Expand Up @@ -122,7 +123,11 @@ private CompletableFuture<Object> findPrototypeInstance(Class<?> type) {
private CompletableFuture<?> callPreInitProcessors() {
List<CompletableFuture<?>> futures = new ArrayList<>();

for (InstanceEntry entry : this.collection) {
// fix ConcurrentModificationException
List<InstanceEntry> snapshot = new ArrayList<>();
this.collection.forEach(snapshot::add);

for (InstanceEntry entry : snapshot) {
Object instance = entry.getInstance();
ContainerObj object = entry.getContainerObject();
if (!this.trySetLifeCycle(object, LifeCycle.PRE_INIT))
Expand Down

0 comments on commit 51c13b4

Please sign in to comment.