This is an automated email from the ASF dual-hosted git repository. thurka pushed a commit to branch vsnetbeans_2701 in repository https://gitbox.apache.org/repos/asf/netbeans.git
commit 29f82fb3659352b8623bc819cd12d37322903cd5 Author: Svatopluk Dědic <[email protected]> AuthorDate: Thu Jul 31 15:00:45 2025 +0200 DAP server waits on its sibling LSP to prime projects. DAP reports init done only afer projects are readable --- .../java/lsp/server/debugging/NbProtocolServer.java | 16 ++++++++++++++++ .../modules/maven/execute/MavenCommandLineExecutor.java | 15 +++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/debugging/NbProtocolServer.java b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/debugging/NbProtocolServer.java index 6fe9ece2c0c..82f5346568d 100644 --- a/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/debugging/NbProtocolServer.java +++ b/java/java.lsp.server/src/org/netbeans/modules/java/lsp/server/debugging/NbProtocolServer.java @@ -81,7 +81,9 @@ import org.netbeans.api.debugger.jpda.InvalidExpressionException; import org.netbeans.api.debugger.jpda.JPDADebugger; import org.netbeans.api.debugger.jpda.ObjectVariable; import org.netbeans.api.debugger.jpda.Variable; +import org.netbeans.api.project.Project; import org.netbeans.modules.debugger.jpda.truffle.vars.TruffleVariable; +import org.netbeans.modules.java.lsp.server.LspServerState; import org.netbeans.modules.java.lsp.server.LspSession; import org.netbeans.modules.java.lsp.server.URITranslator; import org.netbeans.modules.java.lsp.server.debugging.breakpoints.NbBreakpointsRequestHandler; @@ -165,6 +167,20 @@ public final class NbProtocolServer implements IDebugProtocolServer, LspSession. caught.setLabel("Caught Exceptions"); caps.setExceptionBreakpointFilters(new ExceptionBreakpointsFilter[]{uncaught, caught}); caps.setSupportsExceptionInfoRequest(true); + + LspServerState lspServerState = context.getLspSession().getLookup().lookup(LspServerState.class); + if (lspServerState != null) { + CompletableFuture<Project[]> initDone = lspServerState.openedProjects(); + if (!initDone.isDone()) { + LOGGER.log(Level.INFO, "Waiting on LS protocol server {0} to finish initialization", lspServerState); + return lspServerState.openedProjects().thenApply(prjs -> { + LOGGER.log(Level.FINE, "LS protocol server {0} initialized, DAP init complete", lspServerState); + return caps; + }); + } else { + LOGGER.log(Level.FINE, "LS protocol server {0} ready", lspServerState); + } + } return CompletableFuture.completedFuture(caps); } diff --git a/java/maven/src/org/netbeans/modules/maven/execute/MavenCommandLineExecutor.java b/java/maven/src/org/netbeans/modules/maven/execute/MavenCommandLineExecutor.java index 81a7feb329f..c1d60f9c4b7 100644 --- a/java/maven/src/org/netbeans/modules/maven/execute/MavenCommandLineExecutor.java +++ b/java/maven/src/org/netbeans/modules/maven/execute/MavenCommandLineExecutor.java @@ -37,6 +37,7 @@ import java.util.Locale; import java.util.Map; import java.util.UUID; import java.util.concurrent.ExecutionException; +import java.util.concurrent.atomic.AtomicInteger; import java.util.function.Consumer; import java.util.logging.Level; import java.util.logging.Logger; @@ -128,6 +129,12 @@ public class MavenCommandLineExecutor extends AbstractMavenExecutor { private String processUUID; private Process preProcess; private String preProcessUUID; + + /** + * Diagnostics: stracktrace that shows what code requested the execution. + */ + private final Throwable trace; + private static final SpecificationVersion VER18 = new SpecificationVersion("1.8"); //NOI18N private static final Logger LOGGER = Logger.getLogger(MavenCommandLineExecutor.class.getName()); @@ -191,6 +198,11 @@ public class MavenCommandLineExecutor extends AbstractMavenExecutor { public MavenCommandLineExecutor(RunConfig conf, InputOutput io, TabContext tc) { super(conf, tc); this.io = io; + if (LOGGER.isLoggable(Level.FINER)) { + this.trace = new Throwable(); + } else { + this.trace = null; + } } /** @@ -331,6 +343,8 @@ public class MavenCommandLineExecutor extends AbstractMavenExecutor { // ioput.getOut().println(key + ":" + env.get(key)); // } ProcessBuilder builder = constructBuilder(clonedConfig, ioput); + LOGGER.log(Level.FINER, "Executing process {0} from {1}", new Object[] { builder.command(), this }); + LOGGER.log(Level.FINER, "Origin:", this.trace); printCoSWarning(clonedConfig, ioput); processUUID = UUID.randomUUID().toString(); builder.environment().put(KEY_UUID, processUUID); @@ -348,6 +362,7 @@ public class MavenCommandLineExecutor extends AbstractMavenExecutor { throw death; } finally { BuildExecutionSupport.registerFinishedItem(item); + LOGGER.log(Level.FINER, "Execution of {0} terminated", this ); try { //defend against badly written extensions.. out.buildFinished(); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
