Skip to content

Commit

Permalink
ExecutorFactory: switch to CopyOnWriteArrayList for executionListeners
Browse files Browse the repository at this point in the history
This would allow adding/removing executionListeners while in the middle of an execution listener. The current
version of the DAP adapter relies on being able to attach itself during the "about to execute" event.
  • Loading branch information
agarciadom committed Aug 28, 2024
1 parent 9998626 commit 1e21cea
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.concurrent.CopyOnWriteArrayList;

import org.eclipse.epsilon.common.function.BaseDelegate;
import org.eclipse.epsilon.common.module.ModuleElement;
import org.eclipse.epsilon.eol.EolModule;
Expand All @@ -22,7 +24,10 @@
import org.eclipse.epsilon.eol.exceptions.EolRuntimeException;
import org.eclipse.epsilon.eol.exceptions.flowcontrol.EolTerminationException;
import org.eclipse.epsilon.eol.execute.context.IEolContext;
import org.eclipse.epsilon.eol.execute.control.*;
import org.eclipse.epsilon.eol.execute.control.DefaultExecutionController;
import org.eclipse.epsilon.eol.execute.control.ExecutionController;
import org.eclipse.epsilon.eol.execute.control.ExecutionProfiler;
import org.eclipse.epsilon.eol.execute.control.IExecutionListener;

/**
* This class is not thread-safe.
Expand Down Expand Up @@ -72,7 +77,7 @@ public final StackTraceManager getStackTraceManager() {

public void addExecutionListener(IExecutionListener listener) {
if (executionListeners == null) {
executionListeners = new ArrayList<>(1);
executionListeners = new CopyOnWriteArrayList<>();
}
executionListeners.add(listener);
}
Expand Down

0 comments on commit 1e21cea

Please sign in to comment.