Skip to content

Commit

Permalink
Address review suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
HindujaB committed Oct 7, 2024
1 parent 08e776c commit e9e726b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1107,8 +1107,7 @@ private void attachToRemoteVM(String hostName, int portName) throws IOException,
VirtualMachine attachedVm = executionManager.attach(hostName, portName);
context.setDebuggeeVM(new VirtualMachineProxyImpl(attachedVm));
EventRequestManager erm = context.getEventManager();
ClassPrepareRequest classPrepareRequest = erm.createClassPrepareRequest();
classPrepareRequest.enable();
erm.createClassPrepareRequest().enable();
erm.createThreadStartRequest().enable();
erm.createThreadDeathRequest().enable();
eventProcessor.startListening();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import java.util.LinkedHashMap;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CopyOnWriteArrayList;

import static org.ballerinalang.debugadapter.BreakpointProcessor.DynamicBreakpointMode;
import static org.ballerinalang.debugadapter.JBallerinaDebugServer.isBalStackFrame;
Expand All @@ -59,8 +60,8 @@ public class JDIEventProcessor {
private final BreakpointProcessor breakpointProcessor;
private boolean isRemoteVmAttached = false;
private final List<EventRequest> stepRequests = new ArrayList<>();
private static final List<ThreadReference> virtualThreads = new CopyOnWriteArrayList<>();
private static final Logger LOGGER = LoggerFactory.getLogger(JDIEventProcessor.class);
private static final List<ThreadReference> virtualThreads = new ArrayList<>();

JDIEventProcessor(ExecutionContext context) {
this.context = context;
Expand Down Expand Up @@ -132,16 +133,13 @@ private void processEvent(EventSet eventSet, Event event) {
} else if (event instanceof ThreadStartEvent threadStartEvent) {
ThreadReference thread = threadStartEvent.thread();
if (thread.isVirtual()) {
synchronized (virtualThreads) {
virtualThreads.add(thread);
}
virtualThreads.add(thread);

}
eventSet.resume();
} else if (event instanceof ThreadDeathEvent threadDeathEvent) {
ThreadReference thread = threadDeathEvent.thread();
synchronized (virtualThreads) {
virtualThreads.remove(thread);
}
virtualThreads.remove(thread);
eventSet.resume();
} else {
eventSet.resume();
Expand Down

0 comments on commit e9e726b

Please sign in to comment.