Skip to content

Commit

Permalink
EpsilonDebugAdapter: ensure onAttach is only called once per run
Browse files Browse the repository at this point in the history
  • Loading branch information
agarciadom committed Aug 28, 2024
1 parent c8406f8 commit 9998626
Showing 1 changed file with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -423,20 +423,20 @@ public CompletableFuture<Capabilities> initialize(InitializeRequestArguments arg
});
}

/*
* TODO: support launch via same launch properties as used by Eclipse launch
* configurations?
*/

@Override
public CompletableFuture<Void> attach(Map<String, Object> args) {
return CompletableFuture.runAsync(() -> {
// Prepare the suspended state
suspendedState = new SuspendedState();

// Run the onAttach hook (e.g. for starting the configured module)
if (this.onAttach != null) {
this.onAttach.run();
synchronized(this) {
// If this is the first time we're attaching to the module...
if (this.suspendedState == null) {
// Prepare the suspended state
suspendedState = new SuspendedState();

// Run the onAttach hook exactly once (e.g. for starting the configured module)
if (this.onAttach != null) {
this.onAttach.run();
}
}
}
});
}
Expand Down

0 comments on commit 9998626

Please sign in to comment.