diff --git a/vscode-extensions/commons/commons-language-server/src/main/java/org/springframework/ide/vscode/commons/languageserver/util/SimpleLanguageServer.java b/vscode-extensions/commons/commons-language-server/src/main/java/org/springframework/ide/vscode/commons/languageserver/util/SimpleLanguageServer.java index 671801e09..3191933a3 100644 --- a/vscode-extensions/commons/commons-language-server/src/main/java/org/springframework/ide/vscode/commons/languageserver/util/SimpleLanguageServer.java +++ b/vscode-extensions/commons/commons-language-server/src/main/java/org/springframework/ide/vscode/commons/languageserver/util/SimpleLanguageServer.java @@ -161,7 +161,7 @@ public abstract class SimpleLanguageServer implements LanguageServer, LanguageCl protected void validateWith(TextDocument _doc, IReconcileEngine engine) { TextDocument doc = _doc.copy(); - this.busyReconcile = new CompletableFuture(); + CompletableFuture reconcileSession = this.busyReconcile = new CompletableFuture(); SimpleTextDocumentService documents = getTextDocumentService(); IProblemCollector problems = new IProblemCollector() { @@ -216,7 +216,7 @@ public abstract class SimpleLanguageServer implements LanguageServer, LanguageCl engine.reconcile(doc, problems); }) .doOnTerminate((ignore1, ignore2) -> { - busyReconcile.complete(null); + reconcileSession.complete(null); }) .subscribeOn(RECONCILER_SCHEDULER) .subscribe(); diff --git a/vscode-extensions/vscode-boot-properties/src/test/java/org/springframework/ide/vscode/boot/editor/harness/PropertyIndexHarness.java b/vscode-extensions/vscode-boot-properties/src/test/java/org/springframework/ide/vscode/boot/editor/harness/PropertyIndexHarness.java index 58dbc9004..0a727548d 100644 --- a/vscode-extensions/vscode-boot-properties/src/test/java/org/springframework/ide/vscode/boot/editor/harness/PropertyIndexHarness.java +++ b/vscode-extensions/vscode-boot-properties/src/test/java/org/springframework/ide/vscode/boot/editor/harness/PropertyIndexHarness.java @@ -37,20 +37,23 @@ public class PropertyIndexHarness { private SpringPropertyIndex index = null; private IJavaProject testProject = null; - protected SpringPropertyIndexProvider indexProvider = new SpringPropertyIndexProvider() { + protected final SpringPropertyIndexProvider indexProvider = new SpringPropertyIndexProvider() { + @Override public FuzzyMap getIndex(IDocument doc) { - if (index==null) { - IClasspath classpath = testProject == null ? null : testProject.getClasspath(); - index = new SpringPropertyIndex(valueProviders, classpath); - for (ConfigurationMetadataProperty propertyInfo : datas.values()) { - index.add(propertyInfo); + synchronized (PropertyIndexHarness.this) { + if (index==null) { + IClasspath classpath = testProject == null ? null : testProject.getClasspath(); + index = new SpringPropertyIndex(valueProviders, classpath); + for (ConfigurationMetadataProperty propertyInfo : datas.values()) { + index.add(propertyInfo); + } } + return index; } - return index; } }; - public void useProject(IJavaProject p) throws Exception { + public synchronized void useProject(IJavaProject p) throws Exception { index = null; this.testProject = p; } @@ -96,7 +99,7 @@ public class PropertyIndexHarness { } - public ItemConfigurer data(String id, String type, Object deflt, String description, + public synchronized ItemConfigurer data(String id, String type, Object deflt, String description, String... source ) { ConfigurationMetadataProperty item = new ConfigurationMetadataProperty(); @@ -109,7 +112,7 @@ public class PropertyIndexHarness { return new ItemConfigurer(item); } - public void keyHints(String id, String... hintValues) { + public synchronized void keyHints(String id, String... hintValues) { index = null; List hints = datas.get(id).getHints().getKeyHints(); for (String value : hintValues) { @@ -119,7 +122,7 @@ public class PropertyIndexHarness { } } - public void valueHints(String id, String... hintValues) { + public synchronized void valueHints(String id, String... hintValues) { index = null; List hints = datas.get(id).getHints().getValueHints(); for (String value : hintValues) { @@ -129,7 +132,7 @@ public class PropertyIndexHarness { } } - public void deprecate(String key, String replacedBy, String reason) { + public synchronized void deprecate(String key, String replacedBy, String reason) { index = null; ConfigurationMetadataProperty info = datas.get(key); Deprecation d = new Deprecation();