From c65e7ea82bd00264575c84ccb8365f23bf032729 Mon Sep 17 00:00:00 2001 From: Sheng Chen Date: Tue, 18 May 2021 21:18:05 +0800 Subject: [PATCH] Add a timeout to waitForInitializeJobs() (#1773) --- .../src/org/eclipse/jdt/ls/core/internal/JobHelpers.java | 6 +++++- .../jdt/ls/core/internal/handlers/JDTLanguageServer.java | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/JobHelpers.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/JobHelpers.java index f5a79e1bce..162a04a679 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/JobHelpers.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/JobHelpers.java @@ -162,7 +162,11 @@ public static void waitForBuildJobs(int maxTimeMilis) { } public static void waitForInitializeJobs() { - waitForJobs(InitializeJobMatcher.INSTANCE, MAX_TIME_MILLIS); + waitForInitializeJobs(MAX_TIME_MILLIS); + } + + public static void waitForInitializeJobs(int maxTimeMillis) { + waitForJobs(InitializeJobMatcher.INSTANCE, maxTimeMillis); } public static void waitForDownloadSourcesJobs(int maxTimeMillis) { diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/JDTLanguageServer.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/JDTLanguageServer.java index 080cff5a47..9827824709 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/JDTLanguageServer.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/JDTLanguageServer.java @@ -243,7 +243,7 @@ public CompletableFuture initialize(InitializeParams params) { public void initialized(InitializedParams params) { logInfo(">> initialized"); try { - JobHelpers.waitForInitializeJobs(); + JobHelpers.waitForInitializeJobs(60 * 60 * 1000); // 1 hour } catch (OperationCanceledException e) { logException(e.getMessage(), e); }